split¶
dragon.vm.tensorflow.
split
(
value,
num_or_size_splits,
axis=0,
copy=True,
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)))
axis
can be negative: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.
- copy (bool, optional, default=True) – Copy or create the views of input.
- name (str, optional) – The operation name.
- Returns:
Sequence[dragon.Tensor] – The output tensors.