ptrch_c_m:

I just mentioned that because the resulting tensor grad_fn is Mean , although the backward computation will have all steps, including BCEWithLogits .


Yes, that’s what I had in mind. The backward call should still work as intended and internally the mean reduction would do the same. In your manual approach the grad_fn would point to the mean operation, which shouldn’t be a concern.