Exemplo n.º 1
0
    def test_simple(self):
        x = matrix("x")
        y = x + x
        fgraph = FunctionGraph([x], [y], clone=False)
        shapes = shape_of_variables(fgraph, {x: (5, 5)})
        assert shapes == {x: (5, 5), y: (5, 5)}

        x = matrix("x")
        y = aet.dot(x, x.T)
        fgraph = FunctionGraph([x], [y], clone=False)
        shapes = shape_of_variables(fgraph, {x: (5, 1)})
        assert shapes[x] == (5, 1)
        assert shapes[y] == (5, 5)
Exemplo n.º 2
0
 def test_err(self):
     x = matrix("x")
     subx = x[1:]
     fgraph = FunctionGraph([x], [subx])
     with pytest.raises(ValueError):
         shape_of_variables(fgraph, {x: (10, 10)})
Exemplo n.º 3
0
 def test_subtensor(self):
     x = matrix("x")
     subx = x[1:]
     fgraph = FunctionGraph([x], [subx], clone=False)
     shapes = shape_of_variables(fgraph, {x: (10, 10)})
     assert shapes[subx] == (9, 10)