* Splits a `tf.Tensor` into sub tensors. * * If `numOrSizeSplits` is a number, splits `x` along dimension `axis` * into `numOrSizeSplits` smaller tensors. * Requires that `numOrSizeSplits` evenly divides `x.shape[axis]`. * * If `numOrSizeSplits` is a number array, splits `x` into * `numOrSize
(
x: Tensor|TensorLike, numOrSizeSplits: number[]|number, axis = 0)
| 60 | * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'} |
| 61 | */ |
| 62 | function split_<T extends Tensor>( |
| 63 | x: Tensor|TensorLike, numOrSizeSplits: number[]|number, axis = 0): T[] { |
| 64 | const $x = convertToTensor(x, 'x', 'split'); |
| 65 | |
| 66 | const inputs: SplitVInputs = {x: $x}; |
| 67 | const attr: SplitVAttrs = {numOrSizeSplits, axis}; |
| 68 | |
| 69 | return ENGINE.runKernel( |
| 70 | SplitV, inputs as unknown as NamedTensorMap, |
| 71 | attr as unknown as NamedAttrMap) as unknown as T[]; |
| 72 | } |
| 73 | |
| 74 | export const split = /* @__PURE__ */ op({split_}); |
nothing calls this directly
no test coverage detected
searching dependent graphs…