computeNumElements static method
Returns the number of elements in a flattened (1-D) view of the tensor's shape.
Implementation
static int computeNumElements(List<int> shape) {
int n = 1;
for (var i = 0; i < shape.length; i++) {
n *= shape[i];
}
return n;
}