Skip to content

Commit

Permalink
[primTorch] Rename is_finite->isfinite (pytorch#78211)
Browse files Browse the repository at this point in the history
`isfinite` sounds like a better name, because PyTorch, C++, numpy all have this name instead of `is_finite`

Pull Request resolved: pytorch#78211
Approved by: https://github.com/ngimel, https://github.com/mruberry
  • Loading branch information
zasdfgbnm authored and pytorchmergebot committed May 26, 2022
1 parent 92229ad commit 5ecd30e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,7 @@
("aten::_weight_norm_cuda_interface", datetime.date(9999, 1, 1)),
("aten::_weight_norm_cuda_interface_backward", datetime.date(9999, 1, 1)),
# TODO: FIXME: prims shouldn't be checked
("prims::any", datetime.date(9999, 1, 1)),
("prims::all", datetime.date(9999, 1, 1)),
("prims::empty_like", datetime.date(9999, 1, 1)),
("prims::select", datetime.date(9999, 1, 1)),
("prims::concatenate", datetime.date(9999, 1, 1)),
("prims::.*", datetime.date(9999, 1, 1)),
]

ALLOW_LIST_COMPILED = [
Expand Down
6 changes: 3 additions & 3 deletions torch/_prims/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"exp2",
"fill",
"floor",
"is_finite",
"isfinite",
"is_infinite",
"lgamma",
"log",
Expand Down Expand Up @@ -626,8 +626,8 @@ def _isfinite_nvfuser(fd: Any, a: TensorLikeType):
return fd.Ops.isfinite(a) # type: ignore[attr-defined]


is_finite = _make_elementwise_unary_prim(
"is_finite",
isfinite = _make_elementwise_unary_prim(
"isfinite",
impl_aten=torch.isfinite,
impl_nvfuser=_isfinite_nvfuser,
doc="",
Expand Down
2 changes: 1 addition & 1 deletion torch/_refs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ def _frac(x: TensorLikeType) -> TensorLikeType:

def _isfinite(a: TensorLikeType) -> TensorLikeType:
if utils.is_float_dtype(a.dtype) or utils.is_complex_dtype(a.dtype):
return prims.is_finite(a)
return prims.isfinite(a)

return ones_like(a, dtype=torch.bool)

Expand Down

0 comments on commit 5ecd30e

Please sign in to comment.