tf.keras.ops.hsplit

Split an array into multiple sub-arrays horizontally (column-wise).

x Input tensor.
indices_or_sections If an integer, N, the tensor will be split into N equal sections along axis 1 (if ndim >= 2) or axis 0 (if ndim == 1). If a 1-D array of sorted integers, the entries indicate indices at which the tensor will be split along the axis.

A list of sub-arrays.

Example:

x = keras.ops.arange(16.0).reshape((4, 4))
keras.ops.hsplit(x, 2)
[array([[ 0.,  1.],
       [ 4.,  5.],
       [ 8.,  9.],
       [12., 13.]]),
 array([[ 2.,  3.],
       [ 6.,  7.],
       [10., 11.],
       [14., 15.]])]
keras.ops.hsplit(x, [1, 3])
[array([[0.],
    [4.],
    [8.],
    [12.]]),
array([[1., 2.],
    [5., 6.],
    [9., 10.],
    [13., 14.]]),
array([[3.],
    [7.],
    [11.],
    [15.]])]