Google I/O returns May 18-20! Reserve space and build your schedule Register now

tf.sparse.slice

Slice a SparseTensor based on the start and size.

Used in the notebooks

Used in the guide

For example, if the input is

input_tensor = shape = [2, 7]
[    a   d e  ]
[b c          ]

Graphically the output tensors are:

sparse.slice([0, 0], [2, 4]) = shape = [2, 4]
[    a  ]
[b c    ]

sparse.slice([0, 4], [2, 3]) = shape = [2, 3]
[ d e  ]
[      ]

sp_input The SparseTensor to split.
start 1-D. tensor represents the start of the slice.
size 1-D. tensor represents the size of the slice.
name A name for the operation (optional).

A SparseTensor objects resulting from splicing.

TypeError If sp_input is not a SparseTensor.