Move scalar_check for total_weight in NLLLoss functions to code from codegen. (#30665)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30665
total_weight is a "hidden" output just for autograd, so it's not user visible. The existing test_nn tests cover this (I verified that the new code is executed) and this matches the CPU behavior.
Test Plan: Imported from OSS
Differential Revision: D18782709
Pulled By: gchanan
fbshipit-source-id: 6d1c20eeaeffa14d06f375b37f11e866587f5fa0