You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#print(f"backward shaped grad_output {grad_output.shape}, input {input.shape}, weight {weight.shape} and bias {bias.shape if bias is not None else None}")
142
-
# These needs_input_grad checks are optional and there only to
143
-
# improve efficiency. If you want to make your code simpler, you can
144
-
# skip them. Returning gradients for inputs that don't require it is
145
-
# not an error.
146
71
dim=grad_output.dim()
147
72
ifctx.needs_input_grad[0]:
148
-
#print(f"Computing grad input weight {weight.shape} grad_output {grad_output.shape}")
#print(f"Computed grad weight grad_weight {grad_weight.shape}")
159
80
ifbiasisnotNoneandctx.needs_input_grad[2]:
160
-
#print("Computing grad bias")
161
81
ifdim>2:
162
82
grad_bias=grad_output.sum([iforiinrange(dim-1)])
163
83
else:
164
84
grad_bias=grad_output.sum(0)
165
-
#print("Done computing grad bias")
166
-
#print("needs bias")
167
-
#print(f"backward shaped grad_input {grad_input.shape}, grad_weight {grad_weight.shape}, grad_bias {grad_bias.shape if grad_bias is not None else None}")
# print(f"Warning view tensor for input to module : {module.__class__.__name__}. Backward hooks may not trigger properly")
478
-
#assert len(module.parameters(recurse=False)), "The input tensor to the module is a view, and autograd Function or register_hook is not triggered with view tensors."
# print(f"Warning view tensor for input to module : {module.__class__.__name__}. Backward hooks may not trigger properly")
504
-
#assert len(module.parameters(recurse=False)), "The input tensor to the module is a view, and autograd Function or register_hook is not triggered with view tensors."
# print(f"Warning view tensor for input to module : {module.__class__.__name__}. Backward hooks may not trigger properly")
451
+
#assert len(module.parameters(recurse=False)), "The input tensor to the module is a view, and autograd Function or register_hook is not triggered with view tensors."
0 commit comments