W3cubDocs

/TensorFlow Python

tf.sparse_slice

tf.sparse_slice(
    sp_input,
    start,
    size,
    name=None
)

Defined in tensorflow/python/ops/sparse_ops.py.

Slice a SparseTensor based on the start and `size.

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  ]
[      ]

Args:

  • 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).

Returns:

A SparseTensor objects resulting from splicing.

Raises:

  • TypeError: If sp_input is not a SparseTensor.

© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/sparse_slice