mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
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