Skip to content

Commit 853081a

Browse files
cyyeverpytorchmergebot
authored andcommitted
Replace torch.library.impl_abstract with torch.library.register_fake (pytorch#126606)
To remove the disrupting warning ``` warnings.warn("torch.library.impl_abstract was renamed to " "torch.library.register_fake. Please use that instead; " "we will remove torch.library.impl_abstract in a future " "version of PyTorch.", DeprecationWarning, stacklevel=2) ``` Pull Request resolved: pytorch#126606 Approved by: https://github.com/ezyang
1 parent 5ea956a commit 853081a

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

torch/_custom_ops.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def impl_abstract(qualname, *, func=None):
250250
"""
251251
import torch.library
252252

253-
return torch.library.impl_abstract(qualname, func, _stacklevel=2)
253+
return torch.library.register_fake(qualname, func, _stacklevel=2)
254254

255255

256256
def impl_save_for_backward(qualname, *, func=None):

torch/distributed/pipelining/_IR.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def _pipe_split():
304304
return None
305305

306306

307-
@torch.library.impl_abstract("pippy::_pipe_split") # type: ignore[no-redef]
307+
@torch.library.register_fake("pippy::_pipe_split") # type: ignore[no-redef]
308308
def _pipe_split(): # noqa: F811
309309
return None
310310

torch/onnx/_internal/fx/decomposition_skip.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def register_custom_op(cls):
7171
new_op_qualname = f"{_NEW_OP_NAMESPACE}::{cls.new_op_name}"
7272
torch.library.define(new_op_qualname, cls.new_op_schema)
7373
torch.library.impl(new_op_qualname, "default", cls.replacement)
74-
torch.library.impl_abstract(new_op_qualname, cls.abstract)
74+
torch.library.register_fake(new_op_qualname, cls.abstract)
7575

7676
@classmethod
7777
def replacement(cls, *args, **kwargs):

torch/testing/_internal/custom_op_db.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ def source1_fake(x):
458458

459459
lib.define("source2(Tensor x) -> Tensor")
460460

461-
@torch.library.impl_abstract("_torch_testing::source2", lib=lib)
461+
@torch.library.register_fake("_torch_testing::source2", lib=lib)
462462
def _(x):
463463
return x.clone()
464464

@@ -467,7 +467,7 @@ def _(x):
467467
def source3_fake(x):
468468
return x.clone()
469469

470-
torch.library.impl_abstract("_torch_testing::source3", source3_fake, lib=lib)
470+
torch.library.register_fake("_torch_testing::source3", source3_fake, lib=lib)
471471

472472

473473
@torch.library.custom_op("_torch_testing::source4", mutates_args=())

torch/testing/_internal/hop_db.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def foo_impl_cuda(x, z):
8282
return x, z, x + z
8383

8484

85-
@torch.library.impl_abstract("testlib::mutating_custom_op")
85+
@torch.library.register_fake("testlib::mutating_custom_op")
8686
def foo_impl_abstract(x, z):
8787
return x, z, x + z
8888

0 commit comments

Comments
 (0)