def concatenate(tensors, axis=-1):
"""Concatenates a list of tensors alongside the specified axis.
# Arguments
tensors: list of tensors to concatenate.
axis: concatenation axis.
# Returns
A tensor.
"""
if axis < 0:
rank = ndim(tensors[0])
if rank:
axis %= rank
else:
axis = 0
if py_all([is_sparse(x) for x in tensors]):
return tf.sparse_concat(axis, tensors)
else:
return tf.concat([to_dense(x) for x in tensors], axis)
tensorflow_backend.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录