Skip to content

Commit 88583d4

Browse files
fix: torch.Tensor.log1p frontend (#28906)
1 parent caa3d63 commit 88583d4

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

ivy/functional/frontends/torch/tensor.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,16 +1900,11 @@ def stride(self, dim=None):
19001900
{"2.2 and below": ("float32", "float64", "bfloat16")}, "torch"
19011901
)
19021902
def log1p(self):
1903-
promoted_type = ivy.promote_types(self.dtype, "float32")
1904-
res = torch_frontend.log1p(self)
1905-
return res.to(promoted_type)
1903+
return torch_frontend.log1p(self)
19061904

19071905
@with_supported_dtypes({"2.2 and below": ("float32", "float64")}, "torch")
19081906
def log1p_(self):
1909-
promoted_type = ivy.promote_types(self.dtype, "float32")
1910-
ret = torch_frontend.log1p(self)
1911-
ret = ret.to(promoted_type)
1912-
self.ivy_array = ivy.inplace_update(self.ivy_array, ret.ivy_array)
1907+
self.ivy_array = ivy.inplace_update(self.ivy_array, self.log1p().ivy_array)
19131908
return self
19141909

19151910
def baddbmm(self, batch1, batch2, *, beta=1, alpha=1):

ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8851,7 +8851,6 @@ def test_torch_log1p(
88518851
available_dtypes=helpers.get_dtypes("valid"),
88528852
max_value=1e37,
88538853
),
8854-
test_inplace=st.just(True),
88558854
)
88568855
def test_torch_log1p_(
88578856
dtype_x,

0 commit comments

Comments
 (0)