MCPcopy Create free account
hub / github.com/apache/singa / _run_testing

Method _run_testing

test/python/test_api.py:167–187  ·  view source on GitHub ↗
(x_0, s_0, b_0, rm_0, rv_0, m_0=0.1)

Source from the content-addressed store, hash-verified

165 dev = gpu_dev
166
167 def _run_testing(x_0, s_0, b_0, rm_0, rv_0, m_0=0.1):
168 # np api
169 y_1 = _np_bn_testing(x_0, s_0, b_0, rm_0, rv_0, momentum=m_0)
170
171 # singa api
172 hndl = singa_api.CudnnBatchNormHandle(
173 m_0,
174 tensor.Tensor(device=dev, data=x_0).data)
175 y_2_c = singa_api.GpuBatchNormForwardInference(
176 hndl,
177 tensor.Tensor(device=dev, data=x_0).data,
178 tensor.Tensor(device=dev, data=s_0).data,
179 tensor.Tensor(device=dev, data=b_0).data,
180 tensor.Tensor(device=dev, data=rm_0).data,
181 tensor.Tensor(device=dev, data=rv_0).data)
182 #print(y_1)
183 #print(tensor.to_numpy(_cTensor_to_pyTensor(y_2_c)))
184
185 np.testing.assert_array_almost_equal(
186 y_1, tensor.to_numpy(_cTensor_to_pyTensor(y_2_c)), decimal=3)
187 return
188
189 x_0 = np.array([1, 1, 1, 1, 2, 2, 2, 2, 10, 10, 10, 10, 20, 20, 20, 20],
190 dtype=np.float32).reshape((2, 2, 2, 2))

Callers

nothing calls this directly

Calls 5

_np_bn_testingFunction · 0.85
_cTensor_to_pyTensorFunction · 0.85
CudnnBatchNormHandleMethod · 0.80
TensorMethod · 0.80
BatchNormHandleMethod · 0.80

Tested by

no test coverage detected