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

Function test_empty_backend

test/test_backend.py:96–281  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

94
95
96def test_empty_backend():
97 rnd = np.random.RandomState(0)
98 M = rnd.randn(10, 3)
99 v = rnd.randn(3)
100
101 nx = ot.backend.Backend()
102
103 with pytest.raises(NotImplementedError):
104 nx.from_numpy(M)
105 with pytest.raises(NotImplementedError):
106 nx.to_numpy(M)
107 with pytest.raises(NotImplementedError):
108 nx.set_gradients(0, 0, 0)
109 with pytest.raises(NotImplementedError):
110 nx.zeros((10, 3))
111 with pytest.raises(NotImplementedError):
112 nx.ones((10, 3))
113 with pytest.raises(NotImplementedError):
114 nx.arange(10, 1, 2)
115 with pytest.raises(NotImplementedError):
116 nx.full((10, 3), 3.14)
117 with pytest.raises(NotImplementedError):
118 nx.eye((10, 3))
119 with pytest.raises(NotImplementedError):
120 nx.sum(M)
121 with pytest.raises(NotImplementedError):
122 nx.cumsum(M)
123 with pytest.raises(NotImplementedError):
124 nx.max(M)
125 with pytest.raises(NotImplementedError):
126 nx.min(M)
127 with pytest.raises(NotImplementedError):
128 nx.maximum(v, v)
129 with pytest.raises(NotImplementedError):
130 nx.minimum(v, v)
131 with pytest.raises(NotImplementedError):
132 nx.abs(M)
133 with pytest.raises(NotImplementedError):
134 nx.log(M)
135 with pytest.raises(NotImplementedError):
136 nx.exp(M)
137 with pytest.raises(NotImplementedError):
138 nx.sqrt(M)
139 with pytest.raises(NotImplementedError):
140 nx.power(v, 2)
141 with pytest.raises(NotImplementedError):
142 nx.dot(v, v)
143 with pytest.raises(NotImplementedError):
144 nx.norm(M)
145 with pytest.raises(NotImplementedError):
146 nx.exp(M)
147 with pytest.raises(NotImplementedError):
148 nx.any(M)
149 with pytest.raises(NotImplementedError):
150 nx.isnan(M)
151 with pytest.raises(NotImplementedError):
152 nx.isinf(M)
153 with pytest.raises(NotImplementedError):

Callers

nothing calls this directly

Calls 15

randnMethod · 0.95
from_numpyMethod · 0.95
to_numpyMethod · 0.95
set_gradientsMethod · 0.95
zerosMethod · 0.95
onesMethod · 0.95
arangeMethod · 0.95
fullMethod · 0.95
eyeMethod · 0.95
sumMethod · 0.95
cumsumMethod · 0.95
maxMethod · 0.95

Tested by

no test coverage detected