Uploaded image for project: 'AI Platform Core Components'
  1. AI Platform Core Components
  2. AIPCC-7475

torch.ops.aten.hardtanh should raise an exception when min > max

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • None
    • PyTorch
    • None

          1. 🕵️‍♂️ Detected with [FACTO](https://github.com/meta-pytorch/FACTO)
          1. 🐛 Describe the bug

      The ATen op succeeds but torch.export fails.
      We should either raise this error in the ATen op as well, or allow it when exporting

      ```python
      import torch
      import torch.nn as nn

      class HardtanhModel(nn.Module):
      def _init_(self):
      super(HardtanhModel, self)._init_()

      def forward(self, x):
      return torch.ops.aten.hardtanh(x, min_val=2, max_val=0)

      model = HardtanhModel()
      x = torch.ones([3])

      1. this succeeds
        model
      1. this fails
      2. ValueError: min_val cannot be greater than max_val
        torch.export.export(model, (x,))
        ```
          1. Versions

      nightly

      cc @malfet @albanD @chauhang @penguinwu @avikchaudhuri @gmagogsfm @zhxchen17 @tugsbayasgalan @angelayi @suo @ydwu4

              rh-ee-chleonar Christopher Leonard
              rh-ee-chleonar Christopher Leonard
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: