Skip to content

Commit

Permalink
Merge branch 'master' into sampler-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rusty1s authored Sep 29, 2022
2 parents 390e9a7 + 845ebbf commit 6c2bc85
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions torch_geometric/nn/dense/linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,16 @@ def initialize_parameters(self, module, input):
delattr(self, '_hook')

def _save_to_state_dict(self, destination, prefix, keep_vars):
if is_uninitialized_parameter(self.weight):
if (is_uninitialized_parameter(self.weight)
or torch.onnx.is_in_onnx_export()):
destination[prefix + 'weight'] = self.weight
else:
destination[prefix + 'weight'] = self.weight.detach()
if self.bias is not None:
destination[prefix + 'bias'] = self.bias.detach()
if torch.onnx.is_in_onnx_export():
destination[prefix + 'bias'] = self.bias
else:
destination[prefix + 'bias'] = self.bias.detach()

def _lazy_load_hook(self, state_dict, prefix, local_metadata, strict,
missing_keys, unexpected_keys, error_msgs):
Expand Down

0 comments on commit 6c2bc85

Please sign in to comment.