tensorflow.python.ops 中的 array_op, 类似与numpy中的np.array
示例:
from tensorflow.python.framework import constant_op
from tensorflow.python.ops import array_ops
const0 = tf.constant(10)
const1 = constant_op.constant([10,10,10])
array_ops_result0 = array_ops.expand_dims(const0,axis=0)
array_ops_result1 = array_ops.expand_dims(const1,axis=0)
print("array_ops_result0 = ",array_ops_result0)
print("array_ops_result1 = ",array_ops_result1)
结果:
array_ops_result0 = Tensor("ExpandDims:0", shape=(1,), dtype=int32)
array_ops_result1 = Tensor("ExpandDims_1:0", shape=(1, 3), dtype=int32)
随感:感觉tensorflow在 tensorflow.python.ops模块把python的所有功能都用tensorflow重新复现了一遍。
所以,pytorch是深度学习领域的numpy,tensorflow是另一个python.
1万+



被折叠的 条评论
为什么被折叠?



