Skip to content

Commit 5955c07

Browse files
committed
removed redundant codes.
1 parent 899dcba commit 5955c07

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

tests/test_backends.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,26 +1350,7 @@ def test_floor_divide_various_cases(backend):
13501350
"""
13511351

13521352
def to_backend(z):
1353-
if hasattr(tc.backend, "asarray"):
1354-
return tc.backend.asarray(z)
1355-
1356-
name = getattr(tc.backend, "name", "").lower()
1357-
try:
1358-
if "torch" in name:
1359-
import torch
1360-
1361-
return torch.as_tensor(z)
1362-
if "jax" in name:
1363-
import jax.numpy as jnp
1364-
1365-
return jnp.asarray(z)
1366-
if "tf" in name or "tensorflow" in name:
1367-
import tensorflow as tf
1368-
1369-
return tf.convert_to_tensor(z)
1370-
except Exception:
1371-
pass
1372-
return np.asarray(z)
1353+
return tc.backend.convert_to_tensor(z)
13731354

13741355
out = tc.backend.floor_divide(to_backend([7, 8, 9]), to_backend(2))
13751356
np.testing.assert_array_equal(np.array(out), np.array([3, 4, 4]))

0 commit comments

Comments
 (0)