(shape: ShapeMap[R], public dtype: D, values?: DataTypeMap[D])
| 49 | values: DataTypeMap[D]; |
| 50 | |
| 51 | constructor(shape: ShapeMap[R], public dtype: D, values?: DataTypeMap[D]) { |
| 52 | this.shape = shape.slice() as ShapeMap[R]; |
| 53 | this.size = util.sizeFromShape(shape); |
| 54 | |
| 55 | if (values != null) { |
| 56 | const n = values.length; |
| 57 | util.assert( |
| 58 | n === this.size, |
| 59 | () => `Length of values '${n}' does not match the size ` + |
| 60 | `inferred by the shape '${this.size}'.`); |
| 61 | } |
| 62 | if (dtype === 'complex64') { |
| 63 | throw new Error( |
| 64 | `complex64 dtype TensorBuffers are not supported. Please create ` + |
| 65 | `a TensorBuffer for the real and imaginary parts separately and ` + |
| 66 | `call tf.complex(real, imag).`); |
| 67 | } |
| 68 | this.values = values || util.getArrayFromDType(dtype, this.size); |
| 69 | this.strides = computeStrides(shape); |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Sets a value in the buffer at a given location. |
nothing calls this directly
no test coverage detected