Skip to content

Instantly share code, notes, and snippets.

@jamesr66a
Created July 19, 2018 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesr66a/f3cddce667b22898113ce0be3a2ec3f1 to your computer and use it in GitHub Desktop.
Save jamesr66a/f3cddce667b22898113ce0be3a2ec3f1 to your computer and use it in GitHub Desktop.
import torch
class ClampMod(torch.nn.Module):
def forward(self, x):
return x.clamp(max=3.14, min=4.13)
import io
f = io.BytesIO()
m = ClampMod()
torch.onnx.export(m, (torch.rand(3),), f, verbose=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment