zeros method
Implementation
List zeros(List shape, {String? dtype = 'int'}) {
int mult = 1;
for (int i = 0; i < shape.length; i++) {
mult = mult * shape[i] as int;
}
List temp;
if (dtype == 'int') {
temp = List.generate(mult, (_) => 0);
} else if (dtype == 'double') {
temp = List.generate(mult, (_) => 0.0);
} else {
throw new Exception(
"DartTensorException : Undefined dtype. Choose 'int' or 'double'.");
}
temp = generate(temp, shape);
return temp;
}