Beispiel #1
0
 def setUp(self):
     x = T.IntVariable(1, 'x')
     y = T.IntVariable(1, 'y')
     z = T.IntVariable(2, 'z')
     f = lambda x, y: x == y
     self.op1 = T.BoolBinaryOperator(x, y, '==', '!=', f)
     self.op2 = T.BoolBinaryOperator(x, z, '==', '!=', f)
Beispiel #2
0
    def setUp(self):
        x = T.IntVariable(1, 'x')
        y = T.IntVariable(1, 'y')
        f = lambda x, y: (x, y)
        self.op1 = T.IntBinaryOperator(7, x, y, '+', f)
        self.op2 = T.IntBinaryOperator(8, x, y, '+', f)
        self.op3 = T.IntBinaryOperator(9, x, y, '+', f)

        self.op4 = T.IntBinaryOperator(7, x, y, '+', f, True)
        self.op5 = T.IntBinaryOperator(8, x, y, '+', f, True)
        self.op6 = T.IntBinaryOperator(9, x, y, '+', f, True)
Beispiel #3
0
    def check_type_forward(self, in_types):
        type_check.expect(in_types.size() == 1)
        x_type, = in_types

        type_check.expect(
            x_type.dtype == numpy.float32,
            x_type.ndim == 2,
            x_type.shape[1] == type_check.IntVariable(self.W.shape[1],
                                                      'W.shape[1]'),
        )
Beispiel #4
0
    def check_type_backward(self, in_types, out_types):
        type_check.expect(
            in_types.size() == 1,
            out_types.size() == 1,
        )
        x_type, = in_types
        y_type, = out_types

        type_check.expect(
            y_type.dtype == numpy.float32,
            y_type.ndim == 2,
            y_type.shape[0] == x_type.shape[0],
            y_type.shape[1] == type_check.IntVariable(self.W.shape[1],
                                                      'W.shape[1]'),
        )
Beispiel #5
0
    def check_type_forward(self, in_types):
        type_check.expect(in_types.size() > 0)
        type_check.expect(
            in_types[0].ndim > type_check.IntVariable(self.axis, 'axis'))

        ndim = in_types[0].ndim.eval()
        for i in range(1, in_types.size().eval()):
            type_check.expect(
                in_types[0].dtype == in_types[i].dtype,
                in_types[0].ndim == in_types[i].ndim,
            )
            for d in range(0, ndim):
                if d == self.axis:
                    continue
                type_check.expect(in_types[0].shape[d] == in_types[i].shape[d])
Beispiel #6
0
 def setUp(self):
     self.x = T.IntVariable(1, 'x')
     self.y = T.IntVariable(1, 'y')
Beispiel #7
0
 def setUp(self):
     x = T.IntVariable(1, 'x')
     f = lambda x: (x, )
     self.op1 = T.IntUnaryOperator(8, x, '-', f)
     self.op2 = T.IntUnaryOperator(9, x, '-', f)
Beispiel #8
0
 def setUp(self):
     self.x = T.IntVariable(10, 'x')