'''
#-------------------------模组名称:Numpy--------------------------#
#属性 .ndim .shape .size .dtype .real .imag
#新建数组 .array(object, dtype = None, copy = True, order = None, subok = False, ndmin = 0)
#数据类型转换 .dtype(object, align, copy)
#创建数组
1.未初始化数组 .empty(shape, dtype = float, order = 'C')
2.零数组 .zeros(shape, dtype = float, order = 'C')
3.一数组 .ones(shape, dtype = None, order = 'C')
4.从已有数组 .asarray(a, dtype = None, order = None)
5.范围数组 .arange(start, stop, step, dtype)
6.一维等差数组 .linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None)
7.等比数组 .logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None)
8.随机数组 均匀分布 .random.rand(row,col) .random.uniform(low=0.0, high=1.0, size=None)
.random.randint(low, high=None, size=None, dtype='I')
正态分布 .random.normal(0,1,size=()) .random.randint()
#数组操作
1.形状转换 .reshape(arr, newshape, order='C')
2.数组拷贝 .flatten(order='C')
3.展平数组 .ravel(a,order='C')
4.翻转数组 .transpose(arr, axes)
5.修改维度 .broadcast() .broadcast_to() .expand_dims() .squeeze()
6.分割数组 .split(ary, indices_or_sections, axis) .hsplit() .vsplit()
7.元素添加 .resize(arr, shape) .append(arr, values, axis=None)
.insert(arr, obj, values, axis) .delete(arr, obj, axis)
.unique(arr, return_index, return_inverse, return_counts)
8.矩阵拼接
#位运算
#字符串函数
#数学函数 .sin() .cos() .tan() .around() .floor() .ceil()
#计算函数 .add() .subtract() .multiply()/* .matmul() .divide() .mod()
#统计函数 .amin() .amax()
#排序筛选
#切片 slice()
#广播机制
#输入输出 .save(file, arr, allow_pickle=True, fix_imports=True) .load()
.savetxt(FILENAME, a, fmt="%d", delimiter=",") .loadtxt(FILENAME, dtype=int, delimiter=' ')
#------------------------------------------------------------------#
'''
'''
#-------------------------模组名称:tensorflow--------------------------#
#属性: .dtype .size .shape .rank
#类型转换 .to_int32(a,name='') cast(a,dtypt=,name=)
#常量 .constant([1,1,1])
#零张量 .zeros([row,col],tf.dtype) .zeros_like(a)
#一张量 .ones([row,col],tf.dtype) .ones_like(a)
#对角线 .eye([row,col],tf.dtype)
#等差 .linspce(start,stop,num)
#范围 .range(start,limit,delta)
#随机 .random_normal(shape,mean=,stddev=,seed=)
.random_uniform([row,col],mean=,stddev=,seed=)
#变量 .Variable(a,name='')
#占位符 .placehoder(dtype,shape=,name='')
#形状变换 .reshape(a,shape,name='')
#扩充维度 .expand_dims(a,dim,name='')
#减少维度 .squeeze(a,dim,name='')
#算术操作、矩阵操作、复数操作
.assign(a,b,name='') .add() .subtract() .multiply() .divide() .mod(取模)
.abs(绝对值) .nagetive(取负) .inv(取反) .square() .minimum() .matmul()
.transpose(转置) .reverse(反转) .complex_abs() .real() .imag() .fft()
#规约计算(降维)
.reduce_sum() .reduce_min() .reduce_mean()
#分割操作
#索引
#------------------------------------------------------------------#
'''
'''
#-----------------------------Git的使用-----------------------------#
git init <path> #初始化一个仓库
git add <file> #把文件加入到版本控制
git commit -m #提交到仓库
git clone <repo> #克隆仓库
git clone <repo> <directory> #克隆到指定目录
git clone git@github.com:fsliurujie/test.git --SSH协议
git clone git://github.com/fsliurujie/test.git --GIT协议
git clone https://github.com/fsliurujie/test.git --HTTPS协议
mkdir <dir> #创建一个目录
cd <dir>
git init
git clone [url]
touch hello.py
git add hello.py #添加到缓存区
git commit -m"说明" #提交到仓库
git diff
git rm <file>
git mv
#远程库和本地库保持完全一致
git remote add origin git@github.com:Deepsprings/Recording.git
git push origin master
#------------------------------------------------------------------#
'''
Python中numpy和tensorflow的基本数组操作+Git基本操作
最新推荐文章于 2024-03-12 19:34:38 发布