zeroGrad method
void
zeroGrad()
Implementation
void zeroGrad() {
if (grad is double) {
grad = 0.0 as T;
} else if (grad is List<double>) {
for (int i = 0; i < (grad as List<double>).length; i++) {
(grad as List<double>)[i] = 0.0;
}
} else if (grad is List<List<double>>) {
for (int i = 0; i < (grad as List<List<double>>).length; i++) {
for (int j = 0; j < (grad as List<List<double>>)[i].length; j++) {
(grad as List<List<double>>)[i][j] = 0.0;
}
}
}
}