- 博客(6)
- 收藏
- 关注
原创 x[0],x[1],x[:,1],x[2,:] 区别
x =[[1,2,3], [2,4,5], [3,4,2]] #不使用numpy转化为标准数组,列表不能使用[:,2]等 x=np.array(x) print(x[0]) print(x[1]) print(x[:,1]) print(x[2,:]) 结果 D:\ProgramFiles\anaconda3\python.exe D:/Python/DeepLearning/test1.py [1 2 3] [2 4 5] [2 4 4] [3 4 2] Process f.
2022-02-19 11:00:29
1808
原创 关于tensorflow2.0的tf.Session() as sess的说明
import tensorflow.compat.v1 as tf #import tensorflow as tf tf.disable_eager_execution() #2.0版本与1.0版本不兼容,使用2.0版本时应使用上面的程序完成从1.x到2.x的迁移 a = tf.constant(4) b = tf.constant(7) c = a*b sess = tf.compat.v1.Session() #使用1.0的迁移 print(sess.run(c)) sess.close()#2.
2022-01-27 12:45:43
4463
1
原创 one_hot函数
import numpy as np import tensorflow as tf indices = [0, 1, 1] # rank=1 depth = 8 a = tf.one_hot(indices, depth) # rank=2,输出为[3,3] indices=[0,2,-2,1] #rank=1 depth=7 b=tf.one_hot(indices,depth,on_value=5.0,off_value=1.0,axis=-1) print(a) print(b) .
2022-01-26 23:28:36
1914
原创 dtype 和 shape
import tensorflow as tf import numpy as np a =np.array([[[4,2],[3,4],[5,6]],[[2,1],[3,4],[4,5]]]) print(a.dtype) print(a.shape) 结果: 2022-01-25 14:35:04.044154: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic libr.
2022-01-25 15:12:43
1508
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅