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

Function test_convert_between_backends

test/test_backend.py:78–93  ·  view source on GitHub ↗
(nx)

Source from the content-addressed store, hash-verified

76
77
78def test_convert_between_backends(nx):
79 A = np.zeros((3, 2))
80 B = np.zeros((3, 1))
81
82 A2 = nx.from_numpy(A)
83 B2 = nx.from_numpy(B)
84
85 assert isinstance(A2, nx.__type__)
86 assert isinstance(B2, nx.__type__)
87
88 nx2 = get_backend(A2, B2)
89
90 assert nx2.__name__ == nx.__name__
91
92 assert_array_almost_equal_nulp(nx.to_numpy(A2), A)
93 assert_array_almost_equal_nulp(nx.to_numpy(B2), B)
94
95
96def test_empty_backend():

Callers

nothing calls this directly

Calls 4

get_backendFunction · 0.90
from_numpyMethod · 0.80
to_numpyMethod · 0.80
zerosMethod · 0.45

Tested by

no test coverage detected