Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tf_agents.utils.composite.slice_to

View source on GitHub

Slice a composite tensor along axis from 0 to end.

tf_agents.utils.composite.slice_to(
    tensor, axis, end
)

Examples:

slice_to(tensor, 2, -1) === tensor[:, :, :-1]
sparse_to_dense(slice_to(sparse_tensor, 2, -1))
  === sparse_to_dense(sparse_tensor)[:, :, :-1]

Args:

  • tensor: A Tensor or SparseTensor.
  • axis: A python integer.
  • end: A 0D scalar.

Returns:

The sliced composite tensor.