MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / test_qparams

Function test_qparams

imperative/python/test/unit/core/test_tensor_wrapper.py:197–205  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

195
196
197def test_qparams():
198 x = Tensor(1)
199 assert x.qparams.scale is None
200 x.qparams.scale = Tensor(1.0)
201 assert x.qparams.scale.numpy() == 1.0
202 x2 = copy.copy(x)
203 assert x.qparams is x2.qparams and x2.qparams.scale.numpy() == 1.0
204 x3 = copy.deepcopy(x)
205 assert x.qparams is not x3.qparams and x3.qparams.scale.numpy() == 1.0
206
207
208def test_format():

Callers

nothing calls this directly

Calls 3

TensorClass · 0.90
numpyMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected