MCPcopy Index your code
hub / github.com/numpy/numpy / testScale

Method testScale

tools/swig/test/testTensor.py:137–147  ·  view source on GitHub ↗

Test scale function

(self)

Source from the content-addressed store, hash-verified

135
136 # Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
137 def testScale(self):
138 "Test scale function"
139 print(self.typeStr, "... ", end=' ', file=sys.stderr)
140 scale = Tensor.__dict__[self.typeStr + "Scale"]
141 tensor = np.array([[[1, 0, 1], [0, 1, 0], [1, 0, 1]],
142 [[0, 1, 0], [1, 0, 1], [0, 1, 0]],
143 [[1, 0, 1], [0, 1, 0], [1, 0, 1]]], self.typeCode)
144 scale(tensor, 4)
145 self.assertEqual((tensor == [[[4, 0, 4], [0, 4, 0], [4, 0, 4]],
146 [[0, 4, 0], [4, 0, 4], [0, 4, 0]],
147 [[4, 0, 4], [0, 4, 0], [4, 0, 4]]]).all(), True)
148
149 # Test (type INPLACE_ARRAY3[ANY][ANY][ANY]) typemap
150 def testScaleWrongType(self):

Callers

nothing calls this directly

Calls 1

allMethod · 0.45

Tested by

no test coverage detected