uber/neuropod

Support node_name_mapping for TorchScript models

Opened this issue · 0 comments

The node_name_mapping used in Keras is useful for mapping from input tensors to model inputs. In TorchScript, without this mapping, we need to ensure that every input tensor exactly matches a variable name in the forward() method of the PyTorch model.

Some models like torch.nn.Sequential have pre-baked forward() methods where the user doesn't actually know what the kwargs are, they just call model.forward(x). For the purpose of auto-generating a Neuropod in such a setup, where the user's input tensor name is provided as positional argument whose name does not match any in the TorchScript model, it would be useful to be able to construct such a mapping.