(
private ce: ComputeEngine,
tensorData: TensorData<DT>
)
| 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 | } |
nothing calls this directly
no test coverage detected