-
Notifications
You must be signed in to change notification settings - Fork 487
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e68409
commit bc6b14c
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import torch | ||
import torch_xla | ||
|
||
from typing import List | ||
from torch.library import impl | ||
from torch_xla.core.xla_model import XLA_LIB | ||
|
||
XLA_LIB.define( | ||
"tpu_custom_call_(Tensor(a!) output, Tensor[] inputs, str payload) -> ()", | ||
) | ||
|
||
@impl(XLA_LIB, "tpu_custom_call_", "XLA") | ||
def tpu_custom_call_xla_(output: torch.Tensor, inputs: List[torch.Tensor], payload: str): | ||
torch_xla._XLAC._xla_tpu_custom_call_(output, inputs, payload) | ||
|
||
|
||
@impl(XLA_LIB, "tpu_custom_call_", "CompositeExplicitAutograd") | ||
def tpu_custom_call_(output: torch.Tensor, inputs: List[torch.Tensor], payload: str): | ||
# Do nothing for non-xla tensor. | ||
return |