MCPcopy
hub / github.com/numpy/numpy / testScale

Method testScale

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

Test scale function

(self)

Source from the content-addressed store, hash-verified

131
132 # Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
133 def testScale(self):
134 "Test scale function"
135 print(self.typeStr, "... ", file=sys.stderr)
136 scale = SuperTensor.__dict__[self.typeStr + "Scale"]
137 supertensor = np.arange(3 * 3 * 3 * 3,
138 dtype=self.typeCode).reshape((3, 3, 3, 3))
139 answer = supertensor.copy() * 4
140 scale(supertensor, 4)
141 self.assertEqual((supertensor == answer).all(), True)
142
143 # Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
144 def testScaleWrongType(self):

Callers

nothing calls this directly

Calls 3

reshapeMethod · 0.80
copyMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected