开始使用 TensorFlow
getting started with Tensor Flow
我正在尝试学习张量流。在给定的示例中,我们如何定义等级和形状?我的意思是如何找到等级和形状??
3 # a rank 0 tensor; this is a scalar with shape []
[1. ,2., 3.] # a rank 1 tensor; this is a vector with shape [3]
[[1., 2., 3.], [4., 5., 6.]] # a rank 2 tensor; a matrix with shape [2, 3]
[[[1., 2., 3.]], [[7., 8., 9.]]] # a rank 3 tensor with shape [2, 1, 3]
秩是张量中的维数。参考:
https://en.wikipedia.org/wiki/Tensor
The total number of indices required to identify each component uniquely is equal to the dimension of the array, and is called the order, degree or rank of the tensor.
Shape描述了张量每个维度的元素个数。
在给定的示例中,
[1. ,2., 3.]
是一组只有一个维度的数字。这称为矢量,通常用于表示一条线。
[[1., 2., 3.], [4., 5., 6.]]
是一组二维数。这称为矩阵,通常表示几何上的一组线。 (每行由每个内部括号中的元素描述)
这可以推广到二维以上。
更一般地说,所有这些数字集都称为张量。 TensorFlow 使用这些数字集作为数据结构。
我正在尝试学习张量流。在给定的示例中,我们如何定义等级和形状?我的意思是如何找到等级和形状??
3 # a rank 0 tensor; this is a scalar with shape []
[1. ,2., 3.] # a rank 1 tensor; this is a vector with shape [3]
[[1., 2., 3.], [4., 5., 6.]] # a rank 2 tensor; a matrix with shape [2, 3]
[[[1., 2., 3.]], [[7., 8., 9.]]] # a rank 3 tensor with shape [2, 1, 3]
秩是张量中的维数。参考: https://en.wikipedia.org/wiki/Tensor
The total number of indices required to identify each component uniquely is equal to the dimension of the array, and is called the order, degree or rank of the tensor.
Shape描述了张量每个维度的元素个数。
在给定的示例中,
[1. ,2., 3.]
是一组只有一个维度的数字。这称为矢量,通常用于表示一条线。
[[1., 2., 3.], [4., 5., 6.]]
是一组二维数。这称为矩阵,通常表示几何上的一组线。 (每行由每个内部括号中的元素描述)
这可以推广到二维以上。 更一般地说,所有这些数字集都称为张量。 TensorFlow 使用这些数字集作为数据结构。