MCPcopy Create free account
hub / github.com/pytorch/examples / export_onnx

Function export_onnx

word_language_model/main.py:211–216  ·  view source on GitHub ↗
(path, batch_size, seq_len)

Source from the content-addressed store, hash-verified

209
210
211def export_onnx(path, batch_size, seq_len):
212 print('The model is also exported in ONNX format at {}.'.format(os.path.realpath(args.onnx_export)))
213 model.eval()
214 dummy_input = torch.LongTensor(seq_len * batch_size).zero_().view(-1, batch_size).to(device)
215 hidden = model.init_hidden(batch_size)
216 torch.onnx.export(model, (dummy_input, hidden), path)
217
218
219# Loop over epochs.

Callers 1

main.pyFile · 0.85

Calls 1

init_hiddenMethod · 0.80

Tested by

no test coverage detected