tf.keras.ops.array_split
Stay organized with collections
Save and categorize content based on your preferences.
Splits an array into multiple sub-arrays (unevenly).
tf.keras.ops.array_split(
x, indices_or_sections, axis=0
)
This is similar to keras.ops.split, but it allows for
unequal splits. indices_or_sections must be an integer
that indicates the total number of sub-arrays to create.
If the tensor cannot be divided evenly, the first remainder
splits will have size quotient + 1, and the rest will
have size quotient.
Args |
x
|
Input tensor.
|
indices_or_sections
|
An integer indicating the number of
sub-arrays to create.
|
axis
|
The axis along which to split. Defaults to 0.
|
Returns |
|
A list of sub-tensors.
|
Example:
x = keras.ops.arange(10)
keras.ops.array_split(x, 3)
(array([0, 1, 2, 3], dtype=int32),
array([4, 5, 6], dtype=int32),
array([7, 8, 9], dtype=int32))
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."],[],[]]