Test scale function
(self)
| 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): |