MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / concat

Function concat

tensorflow/python/ops/array_ops.py:1328–1420  ·  view source on GitHub ↗

Concatenates tensors along one dimension. Concatenates the list of tensors `values` along dimension `axis`. If `values[i].shape = [D0, D1, ... Daxis(i), ...Dn]`, the concatenated result has shape [D0, D1, ... Raxis, ...Dn] where Raxis = sum(Daxis(i)) That is, the data fro

(values, axis, name="concat")

Source from the content-addressed store, hash-verified

1326@tf_export("concat")
1327@dispatch.add_dispatch_support
1328def concat(values, axis, name="concat"):
1329 """Concatenates tensors along one dimension.
1330
1331 Concatenates the list of tensors `values` along dimension `axis`. If
1332 `values[i].shape = [D0, D1, ... Daxis(i), ...Dn]`, the concatenated
1333 result has shape
1334
1335 [D0, D1, ... Raxis, ...Dn]
1336
1337 where
1338
1339 Raxis = sum(Daxis(i))
1340
1341 That is, the data from the input tensors is joined along the `axis`
1342 dimension.
1343
1344 The number of dimensions of the input tensors must match, and all dimensions
1345 except `axis` must be equal.
1346
1347 For example:
1348
1349 ```python
1350 t1 = [[1, 2, 3], [4, 5, 6]]
1351 t2 = [[7, 8, 9], [10, 11, 12]]
1352 tf.concat([t1, t2], 0) # [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]
1353 tf.concat([t1, t2], 1) # [[1, 2, 3, 7, 8, 9], [4, 5, 6, 10, 11, 12]]
1354
1355 # tensor t3 with shape [2, 3]
1356 # tensor t4 with shape [2, 3]
1357 tf.shape(tf.concat([t3, t4], 0)) # [4, 3]
1358 tf.shape(tf.concat([t3, t4], 1)) # [2, 6]
1359 ```
1360 As in Python, the `axis` could also be negative numbers. Negative `axis`
1361 are interpreted as counting from the end of the rank, i.e.,
1362 `axis + rank(values)`-th dimension.
1363
1364 For example:
1365
1366 ```python
1367 t1 = [[[1, 2], [2, 3]], [[4, 4], [5, 3]]]
1368 t2 = [[[7, 4], [8, 4]], [[2, 10], [15, 11]]]
1369 tf.concat([t1, t2], -1)
1370 ```
1371
1372 would produce:
1373
1374 ```python
1375 [[[ 1, 2, 7, 4],
1376 [ 2, 3, 8, 4]],
1377
1378 [[ 4, 4, 2, 10],
1379 [ 5, 3, 15, 11]]]
1380 ```
1381
1382 Note: If you are concatenating along a new axis consider using stack.
1383 E.g.
1384
1385 ```python

Callers 9

callMethod · 0.90
callMethod · 0.90
boolean_maskFunction · 0.70
matrix_transposeFunction · 0.70
_batch_gatherFunction · 0.70
batch_gather_ndFunction · 0.70
repeat_with_axisFunction · 0.70
tile_one_dimensionFunction · 0.70
_with_nonzero_rankFunction · 0.70

Calls 4

assert_has_rankMethod · 0.80
identityFunction · 0.70
name_scopeMethod · 0.45
get_shapeMethod · 0.45

Tested by 2

callMethod · 0.72
callMethod · 0.72