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
Could you tell me why there must be a call "_setup_graph()" before load this model.
I am a pytorch beginner and hope to get your answers.
The code is here:
`
def load_model(self):
self._setup_graph()
assert os.path.exists('models/epo%d.tar' % self._epoch_num), 'Weights at epoch %d not found' % self._epoch_num
checkpoint = torch.load('models/epo%d.tar' % self._epoch_num, map_location='cpu')
self.dcrnn_model.load_state_dict(checkpoint['model_state_dict'])
self._logger.info("Loaded model at {}".format(self._epoch_num))
def _setup_graph(self):
with torch.no_grad():
self.dcrnn_model = self.dcrnn_model.eval()
val_iterator = self._data['val_loader'].get_iterator()
for _, (x, y) in enumerate(val_iterator):
x, y = self._prepare_data(x, y)
output = self.dcrnn_model(x)
break
`
The text was updated successfully, but these errors were encountered:
Could you tell me why there must be a call "_setup_graph()" before load this model.
I am a pytorch beginner and hope to get your answers.
The code is here:
`
`
The text was updated successfully, but these errors were encountered: