Skip to content

Commit 87eecab

Browse files
manuelcandalesfacebook-github-bot
authored andcommitted
SpecDB: Add out specs for log, log10, log1p, log2
Summary: Added specs for log variants Reviewed By: SS-JIA Differential Revision: D52921850 fbshipit-source-id: 17b546eb7f1950e1a3a2eb811dddea83298ecabd
1 parent 44e7951 commit 87eecab

File tree

1 file changed

+54
-1
lines changed

1 file changed

+54
-1
lines changed

specdb/db.py

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1715,7 +1715,60 @@
17151715
inspec=[
17161716
InPosArg(ArgType.Tensor, name="self"),
17171717
],
1718-
outspec=[OutArg(ArgType.Tensor)],
1718+
outspec=[
1719+
OutArg(
1720+
ArgType.Tensor,
1721+
constraints=[
1722+
cp.Dtype.In(lambda deps: dt.can_cast_from(torch.float)),
1723+
cp.Dtype.In(lambda deps: dt.can_cast_from(deps[0].dtype)),
1724+
],
1725+
)
1726+
],
1727+
),
1728+
Spec(
1729+
op="log10.default", # (Tensor self) -> Tensor
1730+
inspec=[
1731+
InPosArg(ArgType.Tensor, name="self"),
1732+
],
1733+
outspec=[
1734+
OutArg(
1735+
ArgType.Tensor,
1736+
constraints=[
1737+
cp.Dtype.In(lambda deps: dt.can_cast_from(torch.float)),
1738+
cp.Dtype.In(lambda deps: dt.can_cast_from(deps[0].dtype)),
1739+
],
1740+
)
1741+
],
1742+
),
1743+
Spec(
1744+
op="log1p.default", # (Tensor self) -> Tensor
1745+
inspec=[
1746+
InPosArg(ArgType.Tensor, name="self"),
1747+
],
1748+
outspec=[
1749+
OutArg(
1750+
ArgType.Tensor,
1751+
constraints=[
1752+
cp.Dtype.In(lambda deps: dt.can_cast_from(torch.float)),
1753+
cp.Dtype.In(lambda deps: dt.can_cast_from(deps[0].dtype)),
1754+
],
1755+
)
1756+
],
1757+
),
1758+
Spec(
1759+
op="log2.default", # (Tensor self) -> Tensor
1760+
inspec=[
1761+
InPosArg(ArgType.Tensor, name="self"),
1762+
],
1763+
outspec=[
1764+
OutArg(
1765+
ArgType.Tensor,
1766+
constraints=[
1767+
cp.Dtype.In(lambda deps: dt.can_cast_from(torch.float)),
1768+
cp.Dtype.In(lambda deps: dt.can_cast_from(deps[0].dtype)),
1769+
],
1770+
)
1771+
],
17191772
),
17201773
Spec(
17211774
op="logical_and.default", # (Tensor self, Tensor other) -> Tensor

0 commit comments

Comments
 (0)