def column_index(shape):
"""
Generate a Y index for the given tensor.
.. code-block:: python
[
[ 0, 0, 0, ... ],
[ 1, 1, 1, ... ],
[ n, n, n, ... ],
...
[ height-1, height-1, height-1, ... ]
]
:param list[int] shape:
:return: Tensor
"""
height = shape[0]
width = shape[1]
column_identity = tf.ones([width], dtype=tf.int32)
column_identity = tf.tile(column_identity, [height])
column_identity = tf.reshape(column_identity, [height, width])
column_identity = tf.cumsum(column_identity, exclusive=True)
return column_identity
评论列表
文章目录