tf.keras.ops.hsplit
Stay organized with collections
Save and categorize content based on your preferences.
Split an array into multiple sub-arrays horizontally (column-wise).
tf.keras.ops.hsplit(
x, indices_or_sections
)
Args |
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.
|
Returns |
|
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.]])]
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2026-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-10-31 UTC."],[],[]]