Skip to content

Commit

Permalink
[res] clamp example for PyTorch (Samsung#7989)
Browse files Browse the repository at this point in the history
This PR adds clamp operation in PyTorchExamples.

ONE-DCO-1.0-Signed-off-by: Alexander Efimov <[email protected]>
  • Loading branch information
binarman authored Nov 12, 2021
1 parent 2ec5353 commit 93b1934
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions res/PyTorchExamples/examples/clamp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import torch
import torch.nn as nn


# model
class net_clamp(nn.Module):
def __init__(self):
super().__init__()

def forward(self, input):
return torch.clamp(input, 0, 10)


_model_ = net_clamp()

# dummy input for onnx generation
_dummy_ = torch.randn(1, 2, 3, 3)

0 comments on commit 93b1934

Please sign in to comment.