一、 tf.concat
官方解释文档:https://tensorflow.google.cn/api_docs/python/tf/concat
函数原型:
tf.concat(
values, # 要连接的张量
axis, # 指定的连接维度
name='concat'
)
官方解释:
values: A list of Tensor objects or a single Tensor.
axis: 0-D int32 Tensor. Dimension along which to concatenate. Must be in the range [-
rank(values), rank(values)). As in Python, indexing for axis is 0-based. Positive
axis in the rage of [0, rank(values)) refers to axis-th dimension. And negative axis
refers to axis + rank(values)-th dimension.
name: A name for the operation (optional).
这是将张量按指定维度进行连接的函数。如下面实例所示:
t1 = [[1, 2, 3], [4, 5, 6]]
t2 = [[7, 8, 9], [10, 11, 12]]
tf.concat([t1, t2], 0) # [[1, 2, 3]