Skip to content

Commit

Permalink
Revert "Switched from parameter in can_cast to from_. (#126030)"
Browse files Browse the repository at this point in the history
This reverts commit 06d6bb4.

Reverted #126030 on behalf of https://github.com/huydhn due to Sorry for reverting your change but i need to revert it to avoid a diff train conflict with #125995.  Please help rebase and I will reland the change ([comment](#126030 (comment)))
  • Loading branch information
pytorchmergebot authored and ZelboK committed May 19, 2024
1 parent 675c49f commit 930e757
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions aten/src/ATen/native/TypeProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ ScalarType result_type(const Scalar& scalar1, const Scalar& scalar2) {
return result_type(state);
}

bool can_cast(const at::ScalarType from_, const at::ScalarType to) {
return at::canCast(from_, to);
bool can_cast(const at::ScalarType from, const at::ScalarType to) {
return at::canCast(from, to);
}

ScalarType promote_types(ScalarType type1, ScalarType type2) {
Expand Down
2 changes: 1 addition & 1 deletion aten/src/ATen/native/native_functions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7702,7 +7702,7 @@

- func: result_type.Scalar_Scalar(Scalar scalar1, Scalar scalar2) -> ScalarType

- func: can_cast(ScalarType from_, ScalarType to) -> bool
- func: can_cast(ScalarType from, ScalarType to) -> bool
variants: function

- func: promote_types(ScalarType type1, ScalarType type2) -> ScalarType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@
("aten::_aminmax.dim", datetime.date(2024, 12, 31)),
("aten::_aminmax.out", datetime.date(2024, 12, 31)),
("aten::_aminmax.dim_out", datetime.date(2024, 12, 31)),
# BC-breaking change in can_cast signature: 'from' -> 'from_'
("aten::can_cast", datetime.date(2024, 5, 31)),
]

ALLOW_LIST_COMPILED = [
Expand Down
4 changes: 2 additions & 2 deletions torch/_torch_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2195,13 +2195,13 @@ def merge_dicts(*dicts):
add_docstr(
torch.can_cast,
r"""
can_cast(from_, to) -> bool
can_cast(from, to) -> bool
Determines if a type conversion is allowed under PyTorch casting rules
described in the type promotion :ref:`documentation <type-promotion-doc>`.
Args:
from\_ (dtype): The original :class:`torch.dtype`.
from (dtype): The original :class:`torch.dtype`.
to (dtype): The target :class:`torch.dtype`.
Example::
Expand Down

0 comments on commit 930e757

Please sign in to comment.