Пример #1
0
    def testLogWithOutWhere(self):
        t1 = ones((3, 4), chunk_size=2)

        t2 = log(t1, out=t1)

        self.assertIsInstance(t2.op, TensorLog)
        self.assertEqual(t1.op.out.key, t1.op.input.key)
        self.assertIs(t2, t1)
        self.assertEqual(t2.op.input.extra_params.raw_chunk_size, 2)
        self.assertNotEqual(t2.key, t2.op.input.key)

        t3 = empty((3, 4), chunk_size=2)
        t4 = log(t1, out=t3, where=t1 > 0)
        self.assertIsInstance(t4.op, TensorLog)
        self.assertIs(t4, t3)
        self.assertEqual(t2.op.input.extra_params.raw_chunk_size, 2)
        self.assertNotEqual(t2.key, t2.op.input.key)
Пример #2
0
    def testLogWithOut(self):
        t1 = ones((3, 4), chunk_size=2)

        t2 = log(t1, out=t1)

        self.assertIsInstance(t2.op, Log)
        self.assertEqual(t1.op.out.key, t1.op.input.key)
        self.assertIs(t2, t1)
        self.assertEqual(t2.op.input.params.raw_chunk_size, 2)
        self.assertNotEqual(t2.key, t2.op.input.key)