tensorShape property Null safety

TensorShape tensorShape
override

Shape of the tensor.

Implementation

@override
TensorShape get tensorShape => _tensorShape;
void tensorShape=(TensorShape value)
override

Implementation

@override
set tensorShape(TensorShape value) {
  _tensorShape = value;
  final n = value.numberOfElements;
  if (elements.length < n) {
    final newData = Float32List(n);
    newData.setAll(0, elements);
    _elements = newData;
  } else if (elements.length > n) {
    _elements = Float32List.view(elements.buffer, elements.offsetInBytes, n);
  }
}