TensorFlow学习笔记(16)array_ops.shape浅析

返回张量的维度

测试代码

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())
    原文作者:谢昆明
    原文地址: https://www.jianshu.com/p/07b11a8c04bb
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞