《tensorflow的基本知识》
import tensorflow as tf
a = tf.constant([[0, 1, 2, 3], [4, 5, 6, 7]], dtype=tf.float32)
a_rank = tf.rank(a) # 获取张量的秩
a_shape = tf.shape(a) # 获取张量的形状
b = tf.reshape(a, [4, 2]) # 对张量进行重构
# 运行会话以显示结...
原创
2020-01-03 14:53:07 ·
106 阅读 ·
0 评论