Skip to content

Commit a264129

Browse files
committed
[HOTFIX] Fix default dtype handling in abs function
Ensure that the abs function works correctly when dtype is not provided by defaulting to the tensor's existing dtype. This prevents potential errors caused by missing or None-type dtype inputs.
1 parent 2b00acc commit a264129

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gempy_engine/core/backend_tensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def _transpose(tensor, axes=None):
175175
cls.tfnp.concatenate = _concatenate
176176
cls.tfnp.transpose = _transpose
177177
cls.tfnp.geomspace = lambda start, stop, step: torch.logspace(start, stop, step, base=10)
178-
cls.tfnp.abs = lambda tensor, dtype: tensor.abs().type(dtype)
178+
cls.tfnp.abs = lambda tensor, dtype = None: tensor.abs().type(dtype) if dtype is not None else tensor.abs()
179179

180180
@classmethod
181181
def _wrap_pykeops_functions(cls):

0 commit comments

Comments
 (0)