TensorFlow之Tensor(4)

Tensor(张量)

张量的维度(秩):Rank/Order

维度值

名称 维度值 名称
0 标量 3 3阶张量
1 向量 ... ...
2 矩阵 N N阶张量

Tensor的属性:

A. 数据类型 dtype

    例如:tf.float32,tf.int8/16/32,tf.uint8/16,tf.string,tf.bool,tf.complex64.....

B. 形状Shape

C. 其他

几种Tensor:

Constant【常量】、Placeholder【】、Variable【变量】,SparseTensor【】。

tf.constant

例如:

1 import tensorflow as tf
2 
3 tensor = tf.constant([1,2,3,4,5,6,7])
4 const = tf.constant(3)
View Code

猜你喜欢

转载自www.cnblogs.com/xyqiu90-365/p/9723577.html