Example #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)
Example #2
0
def test_log_without_where():
    t1 = ones((3, 4), chunk_size=2)

    t2 = log(t1, out=t1)

    assert isinstance(t2.op, TensorLog)
    assert t1.op.out.key == t1.op.input.key
    assert t2 is t1
    assert t2.op.input.extra_params.raw_chunk_size == 2
    assert t2.key != t2.op.input.key

    t3 = empty((3, 4), chunk_size=2)
    t4 = log(t1, out=t3, where=t1 > 0)
    assert isinstance(t4.op, TensorLog)
    assert t4 is t3
    assert t2.op.input.extra_params.raw_chunk_size == 2
    assert t2.key != t2.op.input.key