Tensorflow

TensorFlow学习笔记(16)array_ops.shap

2018-11-20  本文已影响0人  谢昆明

返回张量的维度

测试代码

with tf.Session() as sess:
    x=np.asarray([1,2,3,4,5,6,7,8,9,10],dtype=np.float32)

    tensor_x = tf.convert_to_tensor(x, tf.float32)

    # Tensor("Shape:0", shape=(1,), dtype=int32)
    print(array_ops.shape(tensor_x))

    # 10
    print(array_ops.shape(tensor_x).eval())
上一篇 下一篇

猜你喜欢

热点阅读