-
Notifications
You must be signed in to change notification settings - Fork 854
Open
Description
I notice that the input of branch_net is set to requires_grad in the deepxde. Is it nesseary?
As I understand, the input of branch_net's grad is not used.
The result should not be affected, while maybe slow down the training step.
The piece of code is from deepxde/model.py 305-317, and shows the setting step.
def outputs(training, inputs):
self.net.train(mode=training)
with torch.no_grad():
if isinstance(inputs, tuple):
inputs = tuple(
map(lambda x: torch.as_tensor(x).requires_grad_(), inputs)
)
else:
inputs = torch.as_tensor(inputs)
inputs.requires_grad_()
# Clear cached Jacobians and Hessians.
grad.clear()
return self.net(inputs)
Metadata
Metadata
Assignees
Labels
No labels