Skip to content

Commit

Permalink
添加翻译+原文地址修改
Browse files Browse the repository at this point in the history
添加翻译+原文地址修改
  • Loading branch information
nb312 committed Nov 23, 2015
1 parent 445aad7 commit 84545c0
Showing 1 changed file with 37 additions and 52 deletions.
89 changes: 37 additions & 52 deletions SOURCE/resources/dims_types.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,52 @@
# Tensor Ranks, Shapes, and Types <a class="md-anchor" id="AUTOGENERATED-tensor-ranks--shapes--and-types"></a>
# 张量的阶,形式,类型<a class="md-anchor" id="AUTOGENERATED-tensor-ranks--shapes--and-types"></a>
TensorFlow程序是用张量数据结构来表示所有的数据.你可以把一个TensorFlow张量想成是一个n维的数组或列表.一个张量有一个静态类型和动态类型的维数.只有张量可以在计算图中连通于节点之间.

TensorFlow programs use a tensor data structure to represent all data. You can
think of a TensorFlow tensor as an n-dimensional array or list.
A tensor has a static type and dynamic dimensions. Only tensors may be passed
between nodes in the computation graph.

## Rank <a class="md-anchor" id="AUTOGENERATED-rank"></a>
## 阶 <a class="md-anchor" id="AUTOGENERATED-rank"></a>
在TensorFlow系统中,张量通过单位维数来被描述为**.但是张量阶并不和矩阵中的阶是同一个概念.张量阶(有时是关于如*顺序**度数*或者是*n维*)是张量维数的一个数量.比如,下面的张量(使用Python中list定义的)就是2阶.

In the TensorFlow system, tensors are described by a unit of dimensionality
known as *rank*. Tensor rank is not the same as matrix rank. Tensor rank
(sometimes referred to as *order* or *degree* or *n-dimension*) is the number
of dimensions of the tensor. For example, the following tensor (defined as a
Python list) has a rank of 2:

t = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
一个二阶张量就可以认为是我们平常所说的矩阵,一阶张量可以认为是一个向量.对于一个二阶张量你可以用语句`t[i, j]`来访问其中的任何元素.而对于三阶张量你可以用't[i, j, k]'.

A rank two tensor is what we typically think of as a matrix, a rank one tensor
is a vector. For a rank two tensor you can acccess any element with the syntax
`t[i, j]`. For a rank three tensor you would need to address an element with
't[i, j, k]'.

Rank | Math entity | Python example
阶 |数学实例| Python 例子
--- | --- | ---
0 | Scalar (magnitude only) | `s = 483`
1 | Vector (magnitude and direction) | `v = [1.1, 2.2, 3.3]`
2 | Matrix (table of numbers) | `m = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]`
3 | 3-Tensor (cube of numbers) | `t = [[[2], [4], [6]], [[8], [10], [12]], [[14], [16], [18]]]`
n | n-Tensor (you get the idea) | `....`
0 | 纯量 (只有大小) | `s = 483`
1 | 向量(大小和方向) | `v = [1.1, 2.2, 3.3]`
2 | 矩阵(数据表) | `m = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]`
3 | 3阶张量 (数据立体) | `t = [[[2], [4], [6]], [[8], [10], [12]], [[14], [16], [18]]]`
n | n阶 (自己想想看) | `....`

## Shape <a class="md-anchor" id="AUTOGENERATED-shape"></a>
## 形式 <a class="md-anchor" id="AUTOGENERATED-shape"></a>
TensorFlow文档中使用了三种记号来方便地描述张量的维度:阶,形式以及维数.下表展示了他们之间的关系:

The TensorFlow documentation uses three notational conventions to describe
tensor dimensionality: rank, shape, and dimension number. The following table
shows how these relate to one another:

Rank | Shape | Dimension number | Example
阶 | 形式 | 维数 | 实例
--- | --- | --- | ---
0 | [] | 0-D | A 0-D tensor. A scalar.
1 | [D0] | 1-D | A 1-D tensor with shape [5].
2 | [D0, D1] | 2-D | A 2-D tensor with shape [3, 4].
3 | [D0, D1, D2] | 3-D | A 3-D tensor with shape [1, 4, 3].
n | [D0, D1, ... Dn] | n-D | A tensor with shape [D0, D1, ... Dn].

Shapes can be represented via Python lists / tuples of ints, or with the
[`TensorShape` class](../api_docs/python/framework.md#TensorShape).
0 | [] | 0-D | 一个 0维张量. 一个纯量.
1 | [D0] | 1-D | 一个1维张量的形式[5].
2 | [D0, D1] | 2-D |一个2维张量的形式[3, 4].
3 | [D0, D1, D2] | 3-D | 一个3维张量的形式 [1, 4, 3].
n | [D0, D1, ... Dn] | n-D | 一个n维张量的形式 [D0, D1, ... Dn].
形式可以通过Python中的int list或tuples来表示,也或者用[`TensorShape` class](../api_docs/python/framework.md#TensorShape).

## Data types <a class="md-anchor" id="AUTOGENERATED-data-types"></a>
## 数据类型<a class="md-anchor" id="AUTOGENERATED-data-types"></a>
除了维度,Tensors有一个数据类型.你可以为一个张量指定一个下面数据类型中的任意一个类型:

In addition to dimensionality, Tensors have a data type. You can assign any one
of the following data types to a tensor:

Data type | Python type | Description
数据类型 | Python 类型| 描述
--- | --- | ---
`DT_FLOAT` | `tf.float32` | 32 bits floating point.
`DT_DOUBLE` | `tf.float64` | 64 bits floating point.
`DT_INT64` | `tf.int64` | 64 bits signed integer.
`DT_INT32` | `tf.int32` | 32 bits signed integer.
`DT_INT16` | `tf.int16` | 16 bits signed integer.
`DT_INT8` | `tf.int8` | 8 bits signed integer.
`DT_UINT8` | `tf.uint8` | 8 bits unsigned integer.
`DT_STRING` | `tf.string` | Variable length byte arrays. Each element of a Tensor is a byte array.
`DT_BOOL` | `tf.bool` | Boolean.
`DT_COMPLEX64` | `tf.complex64` | Complex number made of two 32 bits floating points: real and imaginary parts.
`DT_QINT32` | `tf.qint32` | 32 bits signed integer used in quantized Ops.
`DT_QINT8` | `tf.qint8` | 8 bits signed integer used in quantized Ops.
`DT_QUINT8` | `tf.quint8` | 8 bits unsigned integer used in quantized Ops.
`DT_FLOAT` | `tf.float32` | 32 位浮点数.
`DT_DOUBLE` | `tf.float64` | 64 位浮点数.
`DT_INT64` | `tf.int64` | 64 位有符号整型r.
`DT_INT32` | `tf.int32` | 32 位有符号整型.
`DT_INT16` | `tf.int16` | 16 位有符号整型.
`DT_INT8` | `tf.int8` | 8位有符号整型.
`DT_UINT8` | `tf.uint8` | 8位无符号整型.
`DT_STRING` | `tf.string` | 可变长度的字节数组.每一个张量元素都是一个字节数组.
`DT_BOOL` | `tf.bool` |布尔型.
`DT_COMPLEX64` | `tf.complex64` | 由两个32位浮点数组成的复数:实数和虚数.
`DT_QINT32` | `tf.qint32` | 用于量化Ops的32位有符号整型.
`DT_QINT8` | `tf.qint8` | 用于量化Ops的8位有符号整型.
`DT_QUINT8` | `tf.quint8` |用于量化Ops的8位无符号整型.
原文:[Tensor Ranks, Shapes, and Types](http://www.tensorflow.org/resources/dims_types.md) 翻译:[nb312](https://github.com/nb312)

0 comments on commit 84545c0

Please sign in to comment.