From 09f5934c8fd473d68cd28b9530689c5a2599dc52 Mon Sep 17 00:00:00 2001 From: Rodrigo De Castro Date: Fri, 30 Jan 2026 14:59:17 -0800 Subject: [PATCH 1/2] add spec for hardshrink.default --- facto/specdb/db.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/facto/specdb/db.py b/facto/specdb/db.py index 6dda077..3372978 100644 --- a/facto/specdb/db.py +++ b/facto/specdb/db.py @@ -2582,6 +2582,30 @@ ], outspec=[OutArg(ArgType.Tensor)], ), + Spec( + op="hardshrink.default", # (Tensor self, Scalar lambd=0.5) -> Tensor + inspec=[ + InPosArg( + ArgType.Tensor, + name="self", + constraints=[ + cp.Dtype.In(lambda deps: dt._floating), + ], + ), + InPosArg( + ArgType.Scalar, + name="lambd", + constraints=[ + cp.Value.Ge(lambda deps, dtype: 0), + # Upper bound to prevent overflow when converting to float16 + # + # Default value for lambd in this operator is 0.5 + cp.Value.Le(lambda deps, dtype: 100), + ], + ), + ], + outspec=[OutArg(ArgType.Tensor)], + ), Spec( op="hardtanh.default", # (Tensor self, Scalar min_val=-1, Scalar max_val=1) -> Tensor inspec=[ From ff014230b190a8c7eaaff14f5349492f4efcafb5 Mon Sep 17 00:00:00 2001 From: Rodrigo De Castro Date: Fri, 6 Feb 2026 15:36:27 -0800 Subject: [PATCH 2/2] Fix lint formatting issues --- facto/specdb/db.py | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/facto/specdb/db.py b/facto/specdb/db.py index 3372978..76ee0ac 100644 --- a/facto/specdb/db.py +++ b/facto/specdb/db.py @@ -2583,28 +2583,28 @@ outspec=[OutArg(ArgType.Tensor)], ), Spec( - op="hardshrink.default", # (Tensor self, Scalar lambd=0.5) -> Tensor - inspec=[ - InPosArg( - ArgType.Tensor, - name="self", - constraints=[ - cp.Dtype.In(lambda deps: dt._floating), - ], - ), - InPosArg( - ArgType.Scalar, - name="lambd", - constraints=[ - cp.Value.Ge(lambda deps, dtype: 0), - # Upper bound to prevent overflow when converting to float16 - # - # Default value for lambd in this operator is 0.5 - cp.Value.Le(lambda deps, dtype: 100), - ], - ), - ], - outspec=[OutArg(ArgType.Tensor)], + op="hardshrink.default", # (Tensor self, Scalar lambd=0.5) -> Tensor + inspec=[ + InPosArg( + ArgType.Tensor, + name="self", + constraints=[ + cp.Dtype.In(lambda deps: dt._floating), + ], + ), + InPosArg( + ArgType.Scalar, + name="lambd", + constraints=[ + cp.Value.Ge(lambda deps, dtype: 0), + # Upper bound to prevent overflow when converting to float16 + # + # Default value for lambd in this operator is 0.5 + cp.Value.Le(lambda deps, dtype: 100), + ], + ), + ], + outspec=[OutArg(ArgType.Tensor)], ), Spec( op="hardtanh.default", # (Tensor self, Scalar min_val=-1, Scalar max_val=1) -> Tensor