def test_clinker_literal_inlining(): x, y, z = inputs() z = Constant(tdouble, 4.12345678) e = add(mul(add(x, y), div(x, y)), bad_sub(bad_sub(x, y), z)) lnk = CLinker().accept(Env([x, y], [e])) fn = lnk.make_function() assert abs(fn(2.0, 2.0) + 0.12345678) < 1e-9 code = lnk.code_gen() # print "=== Code generated ===" # print code assert "4.12345678" in code # we expect the number to be inlined
def test_clinker_literal_inlining(): if not theano.config.cxx: raise SkipTest("G++ not available, so we need to skip this test.") x, y, z = inputs() z = Constant(tdouble, 4.12345678) e = add(mul(add(x, y), div(x, y)), bad_sub(bad_sub(x, y), z)) lnk = CLinker().accept(Env([x, y], [e])) fn = lnk.make_function() assert abs(fn(2.0, 2.0) + 0.12345678) < 1e-9 code = lnk.code_gen() # print "=== Code generated ===" # print code assert "4.12345678" in code # we expect the number to be inlined
def test_clinker_literal_inlining(): if not theano.config.cxx: raise SkipTest("G++ not available, so we need to skip this test.") x, y, z = inputs() z = Constant(tdouble, 4.12345678) e = add(mul(add(x, y), div(x, y)), bad_sub(bad_sub(x, y), z)) lnk = CLinker().accept(Env([x, y], [e])) fn = lnk.make_function() assert abs(fn(2.0, 2.0) + 0.12345678) < 1e-9 code = lnk.code_gen() #print "=== Code generated ===" #print code assert "4.12345678" in code # we expect the number to be inlined