Example #1
0
 def test_fill_grad(self):
     # Fix bug reported at
     # https://groups.google.com/d/topic/theano-users/nQshB8gUA6k/discussion
     x = TensorType(config.floatX, [0, 1, 0])('x')
     y = TensorType(config.floatX, [0, 1, 0])('y')
     e = tensor.second(x, y)
     theano.grad(e.sum(), y)
Example #2
0
 def test_fill_grad(self):
     # Fix bug reported at
     # https://groups.google.com/d/topic/theano-users/nQshB8gUA6k/discussion
     x = TensorType(config.floatX, [0, 1, 0])('x')
     y = TensorType(config.floatX, [0, 1, 0])('y')
     e = tensor.second(x, y)
     theano.grad(e.sum(), y)
Example #3
0
def test_second():
    a0 = tt.scalar("a0")
    b = tt.scalar("b")

    out = theano.scalar.basic.second(a0, b)
    fgraph = theano.gof.FunctionGraph([a0, b], [out])
    compare_jax_and_py(fgraph, [10.0, 5.0])

    a1 = tt.vector("a1")
    out = tt.second(a1, b)
    fgraph = theano.gof.FunctionGraph([a1, b], [out])
    compare_jax_and_py(fgraph,
                       [np.zeros([5], dtype=theano.config.floatX), 5.0])