MCPcopy Create free account
hub / github.com/tensorflow/tfjs / split_

Function split_

tfjs-core/src/ops/split.ts:62–72  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

60 * @doc {heading: 'Tensors', subheading: 'Slicing and Joining'}
61 */
62function 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
74export const split = /* @__PURE__ */ op({split_});

Callers

nothing calls this directly

Calls 2

convertToTensorFunction · 0.90
runKernelMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…