computeFlatSize static method

int computeFlatSize(
  1. List<int> shape
)

Calculates number of elements in the buffer.

Implementation

static int computeFlatSize(List<int> shape) {
  SupportPreconditions.checkNotNull(shape, message: "Shape cannot be null.");
  int prod = 1;
  for (int s in shape) {
    prod = prod * s;
  }
  return prod;
}