Repository: microsoft/onnxscript

Issue:
atenlib: Test only float inputs
Functions can be tested on only float inputs to simplify the tests. Other dtypes can be tested on the generated symbolic functions, where all dtypes are expected to be supported.


Discussion:

Resolving patch:
diff --git a/onnxscript/function_libs/torch_aten/ops/core.py b/onnxscript/function_libs/torch_aten/ops/core.py
--- a/onnxscript/function_libs/torch_aten/ops/core.py
+++ b/onnxscript/function_libs/torch_aten/ops/core.py
@@ -11,11 +11,18 @@
 """
 from __future__ import annotations
 
-from typing import Any, Optional, Sequence
+from typing import Any, Optional, Sequence, Union
 
-from onnxscript import BOOL, INT64
+from onnxscript import BOOL, DOUBLE, FLOAT, INT64
 from onnxscript.function_libs.torch_aten.registration import torch_op
-from onnxscript.function_libs.torch_aten.typing import TFloat, TReal, TTensor
+from onnxscript.function_libs.torch_aten.typing import (
+    TFloat,
+    TFloatOrBFloat16,
+    TInt,
+    TReal,
+    TRealUnlessInt16OrInt8,
+    TTensor,
+)
 from onnxscript.onnx_opset import opset18 as op
 from onnxscript.onnx_types import TensorType
 
@@ -567,40 +574,46 @@ def aten_binomial(
     raise NotImplementedError()
 
 
-def aten_bitwise_and(self: TensorType, other: TensorType) -> TensorType:
+@torch_op("aten::bitwise_and")
+def aten_bitwise_and(self: TInt, other: TInt) -> TInt:
     # bitwise_and.Tensor(Tensor self, Tensor other) -> Tensor
 
-    raise NotImplementedError()
+    return op.BitwiseAnd(self, other)
 
 
-def aten_bitwise_left_shift(self: TensorType, other: TensorType) -> TensorType:
+@torch_op("aten::bitwise_left_shift")
+def aten_bitwise_left_shift(self: TInt, other: TInt) -> TInt:
     # bitwise_left_shift.Tensor(Tensor self, Tensor other) -> Tensor
 
-    raise NotImplementedError()
+    return op.BitShift(self, other, direction="LEFT")
 
 
-def aten_bitwise_not(self: TensorType) -> TensorType:
+@torch_op("aten::bitwise_not")
+def aten_bitwise_not(self: TInt) -> TInt:
     # bitwise_not(Tensor self) -> Tensor
 
-    raise NotImplementedError()
+    return op.BitwiseNot(self)
 
 
-def aten_bitwise_or(self: TensorType, other: TensorType) -> TensorType:
+@torch_op("aten::bitwise_or")
+def aten_bitwise_or(self: TInt, other: TInt) -> TInt:
     # bitwise_or.Tensor(Tensor self, Tensor other) -> Tensor
 
-    raise NotImplementedError()
+    return op.BitwiseOr(self, other)
 
 
-def aten_bitwise_right_shift(self: TensorType, other: TensorType) -> TensorType:
+@torch_op("aten::bitwise_right_shift")
+def aten_bitwise_right_shift(self: TInt, other: TInt) -> TInt:
     # bitwise_right_shift.Tensor(Tensor self, Tensor other) -> Tensor
 
-    raise NotImplementedError()
+    return op.BitShift(self, other, direction="RIGHT")
 
 
-def aten_bitwise_xor(self: TensorType, other: TensorType) -> TensorType:
+@torch_op("aten::bitwise_xor")
+def aten_bitwise_xor(self: TInt, other: TInt) -> TInt:
     # bitwise_xor.Tensor(Tensor self, Tensor other) -> Tensor
 
-    raise NotImplementedError()
+    return op.BitwiseXor(self, other)
 
 
 def aten_blackman_window(window_length: int) -> TensorType:
@@ -1542,10 +1555,11 @@ def aten_equal(self: TensorType, other: TensorType) -> bool:
     raise NotImplementedError()
 
 
-def aten_erf(self: TensorType) -> TensorType:
+@torch_op("aten::erf")
+def aten_erf(self: TReal) -> TReal:
     # erf(Tensor self) -> Tensor
 
-    raise NotImplementedError()
+    return op.Erf(self)
 
 
 def aten_erfc(self: TensorType) -> TensorType:
@@ -1794,10 +1808,11 @@ def aten_fmin(self: TensorType, other: TensorType) -> TensorType:
     raise NotImplementedError()
 
 
-def aten_fmod(self: TensorType, other: TensorType) -> TensorType:
+@torch_op("aten::fmod")
+def aten_fmod(self: TReal, other: TReal) -> TReal:
     # fmod.Tensor(Tensor self, Tensor other) -> Tensor
 
-    raise NotImplementedError()
+    return op.Mod(self, other, fmod=1)
 
 
 def aten_frac(self: TensorType) -> TensorType:
@@ -2321,10 +2336,11 @@ def aten_isfinite(self: TensorType) -> TensorType:
     raise NotImplementedError()
 
 
-def aten_isinf(self: TensorType) -> TensorType:
+@torch_op("aten::isinf")
+def aten_isinf(self: Union[FLOAT, DOUBLE]) -> BOOL:
     # isinf(Tensor self) -> Tensor
 
-    raise NotImplementedError()
+    return op.IsInf(self)
 
 
 def aten_isnan(self: TensorType) -> TensorType:
@@ -2537,28 +2553,32 @@ def aten_logdet(self: TensorType) -> TensorType:
     raise NotImplementedError()
 
 
-def aten_logical_and(self: TensorType, other: TensorType) -> TensorType:
+@torch_op("aten::logical_and")
+def aten_logical_and(self: BOOL, other: BOOL) -> BOOL:
     # logical_and(Tensor self, Tensor other) -> Tensor
 
-    raise NotImplementedError()
+    return op.And(self, other)
 
 
-def aten_logical_not(self: TensorType) -> TensorType:
+@torch_op("aten::logical_not")
+def aten_logical_not(self: BOOL) -> BOOL:
     # logical_not(Tensor self) -> Tensor
 
-    raise NotImplementedError()
+    return op.Not(self)
 
 
-def aten_logical_or(self: TensorType, other: TensorType) -> TensorType:
+@torch_op("aten::logical_or")
+def aten_logical_or(self: BOOL, other: BOOL) -> BOOL:
     # logical_or(Tensor self, Tensor other) -> Tensor
 
-    raise NotImplementedError()
+    return op.Or(self, other)
 
 
-def aten_logical_xor(self: TensorType, other: TensorType) -> TensorType:
+@torch_op("aten::logical_xor")
+def aten_logical_xor(self: BOOL, other: BOOL) -> BOOL:
     # logical_xor(Tensor self, Tensor other) -> Tensor
 
-    raise NotImplementedError()
+    return op.Xor(self, other)
 
 
 def aten_logit(self: TensorType, eps: Optional[float] = None) -> TensorType:
@@ -2696,7 +2716,9 @@ def aten_masked_select_backward(
 
 
 @torch_op("aten::matmul")
-def aten_matmul(self: TFloat, other: TFloat) -> TFloat:
+def aten_matmul(
+    self: TRealUnlessInt16OrInt8, other: TRealUnlessInt16OrInt8
+) -> TRealUnlessInt16OrInt8:
     # matmul(Tensor self, Tensor other) -> Tensor
 
     return op.MatMul(self, other)
@@ -3097,7 +3119,9 @@ def aten_mkldnn_max_pool3d_backward(
 
 
 @torch_op("aten::mm")
-def aten_mm(self: TFloat, mat2: TFloat) -> TFloat:
+def aten_mm(
+    self: TRealUnlessInt16OrInt8, mat2: TRealUnlessInt16OrInt8
+) -> TRealUnlessInt16OrInt8:
     # mm(Tensor self, Tensor mat2) -> Tensor
 
     # TODO(justinchuby): Specify type conversion for uint8/int8/int16
@@ -3391,16 +3415,18 @@ def aten_native_norm(self: TensorType, p: float = 2) -> TensorType:
     raise NotImplementedError()
 
 
-def aten_ne(self: TensorType, other: TensorType) -> TensorType:
+@torch_op("aten::ne")
+def aten_ne(self: TReal, other: TReal) -> BOOL:
     # ne.Tensor(Tensor self, Tensor other) -> Tensor
 
-    raise NotImplementedError()
+    return op.Not(op.Equal(self, other))
 
 
-def aten_neg(self: TensorType) -> TensorType:
+@torch_op("aten::neg")
+def aten_neg(self: TReal) -> TReal:
     # neg(Tensor self) -> Tensor
 
-    raise NotImplementedError()
+    return op.Neg(self)
 
 
 def aten_negative(self: TensorType) -> TensorType:
@@ -3445,10 +3471,11 @@ def aten_nextafter(self: TensorType, other: TensorType) -> TensorType:
     raise NotImplementedError()
 
 
-def aten_nonzero(self: TensorType) -> TensorType:
+@torch_op("aten::nonzero")
+def aten_nonzero(self: TTensor) -> INT64:
     # nonzero(Tensor self) -> Tensor
 
-    raise NotImplementedError()
+    return op.NonZero(self)
 
 
 def aten_nonzero_numpy(self: TensorType) -> TensorType:
@@ -3938,10 +3965,11 @@ def aten_real(self: TensorType) -> TensorType:
     raise NotImplementedError()
 
 
-def aten_reciprocal(self: TensorType) -> TensorType:
+@torch_op("aten::reciprocal")
+def aten_reciprocal(self: TFloatOrBFloat16) -> TFloatOrBFloat16:
     # reciprocal(Tensor self) -> Tensor
 
-    raise NotImplementedError()
+    return op.Reciprocal(self)
 
 
 def aten_record_stream(self: TensorType, s: str) -> Any:
@@ -3956,16 +3984,21 @@ def aten_refine_names(self: TensorType, names: Sequence[str]) -> TensorType:
     raise NotImplementedError()
 
 
-def aten_relu(self: TensorType) -> TensorType:
-    # relu(Tensor self) -> Tensor
+@torch_op("aten::remainder")
+def aten_remainder(self: TFloatOrBFloat16, other: TFloatOrBFloat16) -> TFloatOrBFloat16:
+    # remainder.Tensor(Tensor self, Tensor other) -> Tensor
 
-    raise NotImplementedError()
+    # a - a.div(b, rounding_mode="floor") * b
+    rounded_quotient = op.Floor(op.Div(self, other))
+
+    return op.Sub(self, op.Mul(rounded_quotient, other))
 
 
-def aten_remainder(self: TensorType, other: TensorType) -> TensorType:
+@torch_op("aten::remainder", overload=True)
+def aten_remainder_int(self: TInt, other: TInt) -> TInt:
     # remainder.Tensor(Tensor self, Tensor other) -> Tensor
 
-    raise NotImplementedError()
+    return op.Mod(self, other)
 
 
 def aten_rename(self: TensorType, names: Optional[str]) -> TensorType:
@@ -4131,10 +4164,11 @@ def aten_rshift(self: TensorType, other: TensorType) -> TensorType:
     raise NotImplementedError()
 
 
-def aten_rsqrt(self: TensorType) -> TensorType:
+@torch_op("aten::rsqrt")
+def aten_rsqrt(self: TFloatOrBFloat16) -> TFloatOrBFloat16:
     # rsqrt(Tensor self) -> Tensor
 
-    raise NotImplementedError()
+    return op.Reciprocal(op.Sqrt(self))
 
 
 def aten_rsub(self: TensorType, other: TensorType, alpha: float = 1) -> TensorType:
@@ -4218,16 +4252,18 @@ def aten_sgn(self: TensorType) -> TensorType:
     raise NotImplementedError()
 
 
-def aten_sigmoid(self: TensorType) -> TensorType:
+@torch_op("aten::sigmoid")
+def aten_sigmoid(self: TFloatOrBFloat16) -> TFloatOrBFloat16:
     # sigmoid(Tensor self) -> Tensor
 
-    raise NotImplementedError()
+    return op.Sigmoid(self)
 
 
-def aten_sign(self: TensorType) -> TensorType:
+@torch_op("aten::sign")
+def aten_sign(self: TReal) -> TReal:
     # sign(Tensor self) -> Tensor
 
-    raise NotImplementedError()
+    return op.Sign(self)
 
 
 def aten_signbit(self: TensorType) -> TensorType:
@@ -4358,10 +4394,11 @@ def aten_split_with_sizes_copy(
     raise NotImplementedError()
 
 
-def aten_sqrt(self: TensorType) -> TensorType:
+@torch_op("aten::sqrt")
+def aten_sqrt(self: TFloatOrBFloat16) -> TFloatOrBFloat16:
     # sqrt(Tensor self) -> Tensor
 
-    raise NotImplementedError()
+    return op.Sqrt(self)
 
 
 def aten_square(self: TensorType) -> TensorType:
@@ -4783,10 +4820,12 @@ def aten_unsafe_split_with_sizes(
     raise NotImplementedError()
 
 
-def aten_unsqueeze(self: TensorType, dim: int) -> TensorType:
+@torch_op("aten::unsqueeze")
+def aten_unsqueeze(self: TTensor, dim: int) -> TTensor:
     # unsqueeze(Tensor(a) self, int dim) -> Tensor(a)
 
-    raise NotImplementedError()
+    dim = op.Cast(dim, to=INT64.dtype)
+    return op.Unsqueeze(self, dim)
 
 
 def aten_unsqueeze_copy(self: TensorType, dim: int) -> TensorType:
diff --git a/onnxscript/function_libs/torch_aten/ops/nn.py b/onnxscript/function_libs/torch_aten/ops/nn.py
--- a/onnxscript/function_libs/torch_aten/ops/nn.py
+++ b/onnxscript/function_libs/torch_aten/ops/nn.py
@@ -18,7 +18,7 @@
 
 from onnxscript import INT64
 from onnxscript.function_libs.torch_aten.registration import torch_op
-from onnxscript.function_libs.torch_aten.typing import TFloat
+from onnxscript.function_libs.torch_aten.typing import TFloat, TFloatOrBFloat16, TReal
 from onnxscript.onnx_opset import opset18 as op
 from onnxscript.onnx_types import TensorType
 
@@ -398,10 +398,11 @@ def aten_l1_loss(self: TensorType, target: TensorType, reduction: int = 1) -> Te
     raise NotImplementedError()
 
 
-def aten_leaky_relu(self: TensorType, negative_slope: float = 0.01) -> TensorType:
+@torch_op("aten::leaky_relu")
+def aten_leaky_relu(self: TFloatOrBFloat16, negative_slope: float = 0.01) -> TFloatOrBFloat16:
     # leaky_relu(Tensor self, Scalar negative_slope=0.01) -> Tensor
 
-    raise NotImplementedError()
+    return op.LeakyRelu(self, alpha=negative_slope)
 
 
 def aten_leaky_relu_backward(
@@ -799,11 +800,19 @@ def aten_reflection_pad3d_backward(
     raise NotImplementedError()
 
 
+@torch_op("aten::relu")
+def aten_relu(self: TReal) -> TReal:
+    # relu(Tensor self) -> Tensor
+
+    return op.Relu(self)
+
+
 @torch_op("aten::relu6")
-def aten_relu6(self: TFloat) -> TFloat:
+def aten_relu6(self: TReal) -> TReal:
     # relu6(Tensor self) -> Tensor
 
-    return op.Min(op.Relu(self), op.Constant(value_float=6.0))
+    six = op.CastLike(op.Constant(value_int=6), self)
+    return op.Min(op.Relu(self), six)
 
 
 def aten_replication_pad1d(self: TensorType, padding: INT64) -> TensorType:
diff --git a/onnxscript/function_libs/torch_aten/typing.py b/onnxscript/function_libs/torch_aten/typing.py
--- a/onnxscript/function_libs/torch_aten/typing.py
+++ b/onnxscript/function_libs/torch_aten/typing.py
@@ -22,11 +22,10 @@
     INT32,
     INT64,
     UINT8,
-    UINT16,
-    UINT32,
-    UINT64,
 )
 
+# NOTE: We do not care about unsigned types beyond UINT8 because PyTorch does not us them.
+
 _TensorType = Union[
     BFLOAT16,
     BOOL,
@@ -40,9 +39,6 @@
     INT32,
     INT64,
     UINT8,
-    UINT16,
-    UINT32,
-    UINT64,
 ]
 _FloatType = Union[FLOAT16, FLOAT, DOUBLE]
 _IntType = Union[INT8, INT16, INT32, INT64]
@@ -55,13 +51,13 @@
     INT16,
     INT32,
     INT64,
-    UINT8,
-    UINT16,
-    UINT32,
-    UINT64,
 ]
 
 TTensor = TypeVar("TTensor", bound=_TensorType)
 TFloat = TypeVar("TFloat", bound=_FloatType)
+TFloatOrBFloat16 = TypeVar("TFloatOrBFloat16", bound=Union[FLOAT16, FLOAT, DOUBLE, BFLOAT16])
 TInt = TypeVar("TInt", bound=_IntType)
 TReal = TypeVar("TReal", bound=_RealType)
+TRealUnlessInt16OrInt8 = TypeVar(
+    "TRealUnlessInt16OrInt8", bound=Union[FLOAT16, FLOAT, DOUBLE, BFLOAT16, INT32, INT64]
+)


Test patch:
diff --git a/onnxscript/test/function_libs/torch_aten/ops_correctness_test.py b/onnxscript/test/function_libs/torch_aten/ops_correctness_test.py
--- a/onnxscript/test/function_libs/torch_aten/ops_correctness_test.py
+++ b/onnxscript/test/function_libs/torch_aten/ops_correctness_test.py
@@ -19,20 +19,8 @@
 
 T = TypeVar("T")
 
-SUPPORTED_DTYPES = (
-    # Boolean
-    torch.bool,
-    # Integers
-    torch.uint8,
-    torch.int8,
-    torch.int16,
-    torch.int32,
-    torch.int64,
-    # Floating types
-    torch.float16,
-    torch.float32,
-    torch.float64,
-)
+# Test only float32 inputs. All dtypes will be tested on the generated symbolic functions.
+TESTED_DTYPES = (torch.float32,)
 
 # Convenience tuples for creating dtype lists when skipping or xfailing tests
 
@@ -55,7 +43,7 @@
 
 def dtypes_except(*dtypes: torch.dtype) -> Sequence[torch.dtype]:
     """Returns all dtypes except the ones specified."""
-    return tuple(dtype for dtype in SUPPORTED_DTYPES if dtype not in dtypes)
+    return tuple(dtype for dtype in TESTED_DTYPES if dtype not in dtypes)
 
 
 @dataclasses.dataclass
@@ -177,28 +165,43 @@ def wrapped(fn):
     "cos": core_ops.aten_cos,
     "cosh": core_ops.aten_cosh,
     "dot": core_ops.aten_dot,
+    "erf": core_ops.aten_erf,
     "exp": core_ops.aten_exp,
     "exp2": core_ops.aten_exp2,
+    "fmod": core_ops.aten_fmod,
     "gt": core_ops.aten_gt,
+    "isinf": core_ops.aten_isinf,
     "lt": core_ops.aten_lt,
     "matmul": core_ops.aten_matmul,
     "mm": core_ops.aten_mm,
     "mul": core_ops.aten_mul,
+    "ne": core_ops.aten_ne,
+    "neg": core_ops.aten_neg,
     "nn.functional.elu": nn_ops.aten_elu,
+    "nn.functional.leaky_relu": nn_ops.aten_leaky_relu,
     "nn.functional.linear": nn_ops.aten_linear,
+    "nn.functional.relu": nn_ops.aten_relu,
     "nn.functional.relu6": nn_ops.aten_relu6,
     "nn.functional.selu": core_ops.aten_selu,
+    "nonzero": core_ops.aten_nonzero,
     "ones_like": core_ops.aten_ones_like,
     "ones": core_ops.aten_ones,
+    "reciprocal": core_ops.aten_reciprocal,
+    "remainder": core_ops.aten_remainder,
     "repeat": core_ops.aten_repeat,
     "round": core_ops.aten_round,
+    "rsqrt": core_ops.aten_rsqrt,
+    "sigmoid": core_ops.aten_sigmoid,
+    "sign": core_ops.aten_sign,
     "sin": core_ops.aten_sin,
     "sinh": core_ops.aten_sinh,
+    "sqrt": core_ops.aten_sqrt,
     "sub": core_ops.aten_sub,
     "t": core_ops.aten_t,
     "tan": core_ops.aten_tan,
     "tanh": core_ops.aten_tanh,
     # "transpose": core_ops.aten_transpose,  # TODO(justinchuby): Enable when onnxscript errors are fixed,
+    "unsqueeze": core_ops.aten_unsqueeze,
     "zeros": core_ops.aten_zeros,
     "zeros_like": core_ops.aten_zeros_like,
 }
@@ -206,156 +209,25 @@ def wrapped(fn):
 TESTED_OPS = frozenset(OPINFO_FUNCTION_MAPPING)
 
 EXPECTED_SKIPS_OR_FAILS = (
-    xfail("add", dtypes=BOOL_TYPES, reason="Add is not defined on bool tensors"),
-    xfail(
-        "acos",
-        dtypes=BOOL_TYPES + INT_TYPES,
-        reason="Acos is not defined on bool or int tensors",
-    ),
-    xfail(
-        "acosh",
-        dtypes=BOOL_TYPES + INT_TYPES,
-        reason="Acosh is not defined on bool or int tensors",
-    ),
-    xfail(
-        "addmm",
-        dtypes=[torch.uint8, torch.int8, torch.int16],
-        reason="MatMul is not defined on int16/int8/uint8 tensors",
-        # TODO(justinchuby): Use MatMulInteger
-    ),
-    xfail(
-        "addmm",
-        variant_name="decomposed",
-        dtypes=[torch.uint8, torch.int8, torch.int16],
-        reason="MatMul is not defined on int16/int8/uint8 tensors",
-    ),
-    xfail(
-        "asin",
-        dtypes=BOOL_TYPES + INT_TYPES,
-        reason="Asin is not defined on bool or int tensors",
-    ),
-    xfail(
-        "asinh",
-        dtypes=BOOL_TYPES + INT_TYPES,
-        reason="Asinh is not defined on bool or int tensors",
-    ),
-    xfail(
-        "atan",
-        dtypes=BOOL_TYPES + INT_TYPES,
-        reason="Atan is not defined on bool or int tensors",
-    ),
-    xfail(
-        "atanh",
-        dtypes=BOOL_TYPES + INT_TYPES,
-        reason="Atanh is not defined on bool or int tensors",
-    ),
-    xfail(
-        "bmm",
-        dtypes=[torch.uint8, torch.int8, torch.int16],
-        reason="MatMul is not defined on int16/int8/uint8 tensors",
-    ),
-    xfail(
-        "ceil",
-        dtypes=BOOL_TYPES + INT_TYPES,
-        reason="Ceil is not defined on bool or int tensors",
-    ),
     skip("clamp", reason="Enable when onnxscript errors are fixed"),
-    xfail("clamp_max", dtypes=BOOL_TYPES, reason="Min is not defined on bool tensors"),
-    xfail("clamp_min", dtypes=BOOL_TYPES, reason="Max is not defined on bool tensors"),
-    xfail(
-        "cos",
-        dtypes=BOOL_TYPES + INT_TYPES,
-        reason="Cos is not defined on bool or int tensors",
-    ),
-    xfail(
-        "cosh",
-        dtypes=BOOL_TYPES + INT_TYPES,
-        reason="Cosh is not defined on bool or int tensors",
-    ),
-    xfail(
-        "dot",
-        dtypes=[torch.uint8, torch.int8, torch.int16],
-        reason="MatMul is not defined on int16/int8/uint8 tensors",
-    ),
-    xfail(
-        "exp",
-        dtypes=BOOL_TYPES + INT_TYPES,
-        reason="Exp is not defined on bool or int tensors",
-    ),
-    xfail(
-        "exp2",
-        dtypes=BOOL_TYPES + INT_TYPES,
-        reason="Pow is not defined on bool or int tensors",
-    ),
-    xfail("gt", dtypes=BOOL_TYPES, reason="Greater is not defined on bool tensors"),
-    xfail("lt", dtypes=BOOL_TYPES, reason="Less is not defined on bool tensors"),
-    xfail(
-        "matmul",
-        dtypes=[torch.uint8, torch.int8, torch.int16],
-        reason="MatMul is not defined on int16/int8/uint8 tensors",
-    ),
-    xfail(
-        "mm",
-        dtypes=[torch.uint8, torch.int8, torch.int16],
-        reason="MatMul is not defined on int16/int8/uint8 tensors",
-    ),
-    xfail("mul", dtypes=BOOL_TYPES, reason="Mul is not defined on bool tensors"),
-    xfail(
-        "nn.functional.elu",
-        dtypes=dtypes_except(torch.float16, torch.float32),
-        reason="ONNX Runtime doesn't support float64 for Elu",
-    ),
     xfail(
         "nn.functional.linear",
         reason="ONNX Runtime thinks the graph is invalid",
     ),
-    xfail(
-        "nn.functional.relu6",
-        dtypes=dtypes_except(torch.float16, torch.float32),
-        reason="ONNX Runtime doesn't support float64 for Relu",
-    ),
-    xfail(
-        "nn.functional.selu",
-        dtypes=dtypes_except(torch.float16, torch.float32),
-        reason="ONNX Runtime doesn't support float64 for Selu",
-    ),
-    xfail(
-        "round",
-        variant_name="",
-        dtypes=dtypes_except(*FLOAT_TYPES),
-        reason="Round is not defined on non-float tensors",
-    ),
-    xfail("round", variant_name="decimals_0", reason="The ATen op does not support decimals"),
-    xfail("round", variant_name="decimals_3", reason="The ATen op does not support decimals"),
-    xfail(
-        "round", variant_name="decimals_neg_3", reason="The ATen op does not support decimals"
-    ),
-    xfail(
-        "sin",
-        dtypes=BOOL_TYPES + INT_TYPES,
-        reason="Sin is not defined on bool or int tensors",
-    ),
-    xfail(
-        "sinh",
-        dtypes=BOOL_TYPES + INT_TYPES,
-        reason="Sinh is not defined on bool or int tensors",
-    ),
-    xfail("sub", dtypes=BOOL_TYPES, reason="Sub is not defined on bool tensors"),
-    xfail(
-        "tan",
-        dtypes=BOOL_TYPES + INT_TYPES,
-        reason="Tan is not defined on bool or int tensors",
-    ),
-    xfail(
-        "tanh",
-        dtypes=BOOL_TYPES + INT_TYPES,
-        reason="Tanh is not defined on bool or int tensors",
-    ),
+    xfail("round", variant_name="decimals_0", reason="The op does not support decimals"),
+    xfail("round", variant_name="decimals_3", reason="The op does not support decimals"),
+    xfail("round", variant_name="decimals_neg_3", reason="The op does not support decimals"),
     xfail("transpose", reason="Enable when onnxscript errors are fixed"),
 )
 
 
-SKIP_SUBTESTS: tuple[DecorateMeta, ...] = ()
+SKIP_SUBTESTS: tuple[DecorateMeta, ...] = (
+    skip(
+        "nonzero",
+        matcher=lambda sample: sample.kwargs.get("as_tuple") is True,
+        reason="as_tuple=True is not supported",
+    ),
+)
 OP_WITH_SKIPPED_SUBTESTS = frozenset(meta.op_name for meta in SKIP_SUBTESTS)
 
 # END OF SECTION TO MODIFY #####################################################
@@ -440,7 +312,7 @@ def setUp(self) -> None:
 
     @common_device_type.ops(  # type: ignore[misc]
         [info for info in OPS_DB if info.name in TESTED_OPS],
-        allowed_dtypes=SUPPORTED_DTYPES,
+        allowed_dtypes=TESTED_DTYPES,
     )
     @add_decorate_info(
         OPS_DB,