Did I find the right examples for you? yes no

All Samples(61)  |  Call(59)  |  Derive(0)  |  Import(2)

        def theano_code(expr, cache=global_cache, **kwargs):
    return TheanoPrinter(cache=cache, settings={}).doprint(expr, **kwargs)
        


src/s/y/sympy-0.7.5/sympy/printing/tests/test_theanocode.py   sympy(Download)
sy = sympy
from sympy.abc import x, y, z, a, b, c
from sympy.printing.theanocode import (theano_code, dim_handling,
        theano_function)
 
def test_symbol():
    xt = theano_code(x)
    assert isinstance(xt, (tt.TensorVariable, ts.ScalarVariable))
    assert xt.name == x.name
 
def test_add():
    expr = x + y
    comp = theano_code(expr)
    assert comp.owner.op == theano.tensor.add
 
    comp = theano_code(expr, broadcastables={x: (False,), y: (False,)})
    assert comp.broadcastable == (False,)
 
    comp = theano_code(expr, broadcastables={x: (False, True), y: (False, False)})

src/s/y/sympy-HEAD/sympy/printing/tests/test_theanocode.py   sympy(Download)
sy = sympy
from sympy.abc import x, y, z, a, b, c
from sympy.printing.theanocode import (theano_code, dim_handling,
        theano_function)
 
def test_symbol():
    xt = theano_code(x)
    assert isinstance(xt, (tt.TensorVariable, ts.ScalarVariable))
    assert xt.name == x.name
 
def test_add():
    expr = x + y
    comp = theano_code(expr)
    assert comp.owner.op == theano.tensor.add
 
    comp = theano_code(expr, broadcastables={x: (False,), y: (False,)})
    assert comp.broadcastable == (False,)
 
    comp = theano_code(expr, broadcastables={x: (False, True), y: (False, False)})