MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / constructor

Function constructor

src/compute-engine/tensor/tensors.ts:125–133  ·  view source on GitHub ↗
(
    private ce: ComputeEngine,
    tensorData: TensorData<DT>
  )

Source from the content-addressed store, hash-verified

123 // This helper performs an element-wise operation; it requires identical
124 // shapes (it does not implement NumPy-style shape broadcasting). Mismatched
125 // shapes previously produced silent garbage (e.g. `[2,2]` op `[3]` →
126 // `[…, null]` with shape `[2,2]`); fail loudly instead. (Callers such as
127 // the `Add`/`Multiply` handlers already reject incompatible dimensions
128 // upstream, so this is a defensive guard.)
129 if (
130 lhs_.shape.length !== rhs_.shape.length ||
131 lhs_.shape.some((d, i) => d !== rhs_.shape[i])
132 ) {
133 throw new Error(
134 `Cannot broadcast tensors of incompatible shapes [${lhs_.shape}] and [${rhs_.shape}]`
135 );
136 }

Callers

nothing calls this directly

Calls 2

makeTensorFieldFunction · 0.90
getStridesFunction · 0.85

Tested by

no test coverage detected