东莞购物网站建设国外做海报的网站
Google Colab运行Pytorch项目
- 连接google drive
 - 切换到某一文件夹
 - 显示当前目录文件
 - 安装依赖
 - 执行py文件
 - numpy相关
 - numpy.random.randn()
 
参考文章:文章1 文章2
连接google drive
from google.colab import drive
import os
drive.mount('/content/drive')
 
切换到某一文件夹
import os
os.chdir("/content/drive/MyDrive/Colab Notebooks/intrinsic_dimension-master")
 
显示当前目录文件
!ls
 
安装依赖
!pip install -r requirements.txt
 
执行py文件
! python dataset.py
 
numpy相关
参考文章:文章1
numpy.random.randn()
numpy.random.randn(d0,d1,…,dn)
- randn函数返回一个或一组样本,具有标准正态分布。
 - 返回值为指定维度的array
 
np.random.randn() # 当没有参数时,返回单个数据
-1.1241580894939212
 
np.random.randn(2,4)
array([[ 0.27795239, -2.57882503,  0.3817649 ,  1.42367345],[-1.16724625, -0.22408299,  0.63006614, -0.41714538]])
 
np.random.randn(4,3,2)
array([[[ 1.27820764,  0.92479163],[-0.15151257,  1.3428253 ],[-1.30948998,  0.15493686]],[[-1.49645411, -0.27724089],[ 0.71590275,  0.81377671],[-0.71833341,  1.61637676]],[[ 0.52486563, -1.7345101 ],[ 1.24456943, -0.10902915],[ 1.27292735, -0.00926068]],[[ 0.88303   ,  0.46116413],[ 0.13305507,  2.44968809],[-0.73132153, -0.88586716]]])
