MCPcopy Create free account
hub / github.com/numpy/numpy / testScale

Method testScale

tools/swig/test/testSuperTensor.py:126–133  ·  view source on GitHub ↗

Test scale function

(self)

Source from the content-addressed store, hash-verified

124
125 # Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
126 def testScale(self):
127 "Test scale function"
128 print(self.typeStr, "... ", file=sys.stderr)
129 scale = SuperTensor.__dict__[self.typeStr + "Scale"]
130 supertensor = np.arange(3*3*3*3, dtype=self.typeCode).reshape((3, 3, 3, 3))
131 answer = supertensor.copy()*4
132 scale(supertensor, 4)
133 self.assertEqual((supertensor == answer).all(), True)
134
135 # Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
136 def testScaleWrongType(self):

Callers

nothing calls this directly

Calls 4

printFunction · 0.85
reshapeMethod · 0.80
copyMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected