Esempio n. 1
0
 def check_type_forward(self, in_types):
     type_check.expect(in_types.size() == 1)
     a_type, = in_types
     a_type = matmul._convert_type(a_type)
     type_check.expect(a_type.dtype.kind == 'f')
     # Only a minibatch of 2D array shapes allowed.
     type_check.expect(a_type.ndim == 3)
     # Matrix inversion only allowed for square matrices
     # so assert the last two dimensions are equal.
     type_check.expect(a_type.shape[-1] == a_type.shape[-2])
Esempio n. 2
0
File: det.py Progetto: 2php/chainer
 def check_type_forward(self, in_types):
     type_check.expect(in_types.size() == 1)
     a_type, = in_types
     a_type = matmul._convert_type(a_type)
     type_check.expect(a_type.dtype.kind == 'f')
     # Only a minibatch of 2D array shapes allowed.
     type_check.expect(a_type.ndim == 3)
     # Matrix inversion only allowed for square matrices
     # so assert the last two dimensions are equal.
     type_check.expect(a_type.shape[-1] == a_type.shape[-2])
Esempio n. 3
0
    def check_type_forward(self, in_types):
        type_check.expect(in_types.size() == 1)
        a_type, = in_types

        type_check.expect(a_type.dtype.kind == 'f', )

        _check_ndim(a_type)

        a_type = _convert_type(a_type)
        a_idx = _get_check_index(self.transa, False)
Esempio n. 4
0
    def check_type_forward(self, in_types):
        type_check.expect(in_types.size() == 1)
        a_type = self.value
        b_type = in_types[0]

        type_check.expect(b_type.dtype.kind == "f")

        _matmul._check_ndim(b_type)

        b_type = _matmul._convert_type(b_type)
        a_idx = _matmul._get_check_index(False, False)
        b_idx = _matmul._get_check_index(False, True)
        type_check.expect(a_type.shape[a_idx] == b_type.shape[b_idx])
Esempio n. 5
0
    def check_type_forward(self, in_types):
        type_check.expect(in_types.size() == 1)
        a_type = self.value
        b_type = in_types[0]

        type_check.expect(b_type.dtype.kind == 'f')

        _matmul._check_ndim(b_type)

        b_type = _matmul._convert_type(b_type)
        a_idx = _matmul._get_check_index(False, False)
        b_idx = _matmul._get_check_index(False, True)
        type_check.expect(a_type.shape[a_idx] == b_type.shape[b_idx])
Esempio n. 6
0
    def check_type_forward(self, in_types):
        type_check.expect(in_types.size() == 1)
        a_type, = in_types

        type_check.expect(
            a_type.dtype == numpy.float32
#             ,
#             self.b.dtype == numpy.float32
        )

        _check_ndim(a_type, lower=2, upper=3)
#         _check_ndim(b_type, lower=2, upper=3)

        a_type = _convert_type(a_type, vector_ndim=2)
#         b_type = _convert_type(b_type, vector_ndim=2)
        a_idx = _get_check_index(self.transa, False, row_idx=1, col_idx=2)