split

dragon.vm.tensorflow.split(
  value,
  num_or_size_splits,
  axis=0,
  name=None
)[source]

Split input into chunks along the given axis.

Either number or size of splits will be accepted:

x = tf.constant([[1, 2], [3, 4], [5, 6]])
# Shape: (3, 2) -> (2, 2), (1, 2)
print(tf.split(x, num_or_size_splits=2))
# Shape: (3, 2) -> (1, 2), (2, 2)
print(tf.split(x, num_or_size_splits=(1, 2)))

The axis can be negative representing the last-k axis:

x = tf.constant([[1, 2], [3, 4], [5, 6]])
print(tf.split(x, 2, axis=1))
print(tf.split(x, 2, axis=-1))  # Equivalent
Parameters:
  • value (dragon.Tensor) – The input tensor.
  • num_or_size_splits (Union[int, Sequence[int]]) – The number or size of chunks.
  • axis (int, optional, default=0) – The axis to split.
  • name (str, optional) – The operation name.
Returns:

Sequence[dragon.Tensor] – The outputs.