MCPcopy Create free account
hub / github.com/PythonOT/POT / _from_numpy

Method _from_numpy

ot/backend.py:1534–1540  ·  view source on GitHub ↗
(self, a, type_as=None)

Source from the content-addressed store, hash-verified

1532 return jax.device_put(a, self._get_device(type_as))
1533
1534 def _from_numpy(self, a, type_as=None):
1535 if isinstance(a, float):
1536 a = np.array(a)
1537 if type_as is None:
1538 return jnp.array(a)
1539 else:
1540 return self._change_device(jnp.array(a).astype(type_as.dtype), type_as)
1541
1542 def set_gradients(self, val, inputs, grads):
1543 from jax.flatten_util import ravel_pytree

Callers

nothing calls this directly

Calls 1

_change_deviceMethod · 0.95

Tested by

no test coverage detected