MCPcopy
hub / github.com/tensorflow/tfjs / tensor5d

Function tensor5d

tfjs-core/src/ops/tensor5d.ts:48–67  ·  view source on GitHub ↗
(
    values: TensorLike5D, shape?: [number, number, number, number, number],
    dtype?: DataType)

Source from the content-addressed store, hash-verified

46 * @doc {heading: 'Tensors', subheading: 'Creation'}
47 */
48export function tensor5d(
49 values: TensorLike5D, shape?: [number, number, number, number, number],
50 dtype?: DataType): Tensor5D {
51 assertNonNull(values);
52 if (shape != null && shape.length !== 5) {
53 throw new Error('tensor5d() requires shape to have five numbers');
54 }
55 const inferredShape = inferShape(values, dtype);
56 if (inferredShape.length !== 5 && inferredShape.length !== 1) {
57 throw new Error(
58 'tensor5d() requires values to be ' +
59 'number[][][][][] or flat/TypedArray');
60 }
61 if (inferredShape.length === 1 && shape == null) {
62 throw new Error(
63 'tensor5d() requires shape to be provided when `values` ' +
64 'are a flat array');
65 }
66 return makeTensor(values, shape, inferredShape, dtype) as Tensor5D;
67}

Callers 4

pooling_test.tsFile · 0.90
tensor_test.tsFile · 0.90

Calls 3

assertNonNullFunction · 0.90
inferShapeFunction · 0.90
makeTensorFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…