Files
pytorch/torch/csrc/api
francescocastelli 45d5b3248b Fixed C++ BatchNorm pretty_print() with optional momentum (#67335)
Summary:
Summary : Inserted a check for the momentum and print  "None" in case is not defined. See  https://github.com/pytorch/pytorch/issues/65143

Pull Request resolved: https://github.com/pytorch/pytorch/pull/67335

Test Plan:
The code below now prints `torch::nn::BatchNorm2d(128, eps=1e-05, momentum=None, affine=true, track_running_stats=true)` without generating errors.
```
torch::nn::BatchNorm2d m(torch::nn::BatchNormOptions(128).momentum(c10::nullopt));
std::cerr << *m << "\n";
```
Fixes https://github.com/pytorch/pytorch/issues/65143

Reviewed By: mruberry

Differential Revision: D32067820

Pulled By: ngimel

fbshipit-source-id: f40f9bbe090aa78e00f6c3a57deae393d946b88d
2021-11-01 14:45:33 -07:00
..