🐛 Bug
When doing the following computation: 0.995**100 we see that the following operators produce these results:
torch.pow - tensor(0, device='xla:1')
toch.float_power - tensor(0.6058, device='xla:1')
** - 0.6057704364907279
The following HLOs are produced for each the first two operators
HloModule SyncTensorsGraph.5, entry_computation_layout={(s64[],s64[])->(s64[])}
ENTRY %SyncTensorsGraph.5 (p0: s64[], p1: s64[]) -> (s64[]) {
%p1 = s64[] parameter(1), frontend_attributes={neff_input_name="input1"}
%p0 = s64[] parameter(0), frontend_attributes={neff_input_name="input0"}
%power = s64[] power(s64[] %p1, s64[] %p0)
ROOT %tuple = (s64[]) tuple(s64[] %power), frontend_attributes={neff_output_names="output0"}
}
HloModule SyncTensorsGraph.6, entry_computation_layout={(s64[],f32[])->(f32[])}
ENTRY %SyncTensorsGraph.6 (p0: s64[], p1: f32[]) -> (f32[]) {
%p1 = f32[] parameter(1), frontend_attributes={neff_input_name="input1"}
%p0 = s64[] parameter(0), frontend_attributes={neff_input_name="input0"}
%convert = f32[] convert(s64[] %p0)
%power = f32[] power(f32[] %p1, f32[] %convert)
ROOT %tuple = (f32[]) tuple(f32[] %power), frontend_attributes={neff_output_names="output0"}
}
To Reproduce
Execute the following script:
import torch
import torch_xla.core.xla_model as xm
beta = 0.995
def func1(step):
step = torch.tensor(step, device=xm.xla_device())
factor = torch.pow(beta, step)
print(factor)
def func2(step):
step = torch.tensor(step, device=xm.xla_device())
factor = torch.float_power(beta, step)
factor = factor.float()
print(factor)
def func3(step):
factor = (beta ** step)
print(factor)
func1(100)
func2(100)
func3(100)
Expected behavior
torch.pow should produce the same results as CPU python and torch.float_power
Environment
- Reproducible on XLA backend [CPU/TPU]: Neuron
- torch_xla version:
1.13.1+torchneuron6
🐛 Bug
When doing the following computation:
0.995**100we see that the following operators produce these results:The following HLOs are produced for each the first two operators
To Reproduce
Execute the following script:
Expected behavior
torch.powshould produce the same results as CPU python andtorch.float_powerEnvironment
1.13.1+torchneuron6