getXY method

T getXY(
  1. int x,
  2. int y
)

Gets element value.

Implementation

T getXY(int x, int y) {
  final tensorShape = this.tensorShape;
  if (tensorShape.numberOfDimensions != 2) {
    throw ArgumentError('Shape of the tensor is: $tensorShape');
  }
  if (x < 0 || x >= tensorShape.x) {
    throw ArgumentError.value(x, 'x');
  }
  if (y < 0 || y >= tensorShape.y) {
    throw ArgumentError.value(y, 'y');
  }
  return elements[x + tensorShape.x * y];
}