def check_type_forward(self, in_types): type_check._argname(in_types, ('a', 'b')) a_type, b_type = in_types type_check.expect( a_type.dtype.kind == 'f', b_type.dtype.kind == 'f', a_type.ndim >= 1, b_type.ndim >= 1, ) a_ndim = type_check.eval(a_type.ndim) b_ndim = type_check.eval(b_type.ndim) if b_ndim == 1: a_idx = -2 if self.transa and a_ndim > 1 else -1 type_check.expect(a_type.shape[a_idx] == b_type.shape[0]) elif a_ndim == 1: b_idx = -1 if self.transb and b_ndim > 1 else -2 type_check.expect(a_type.shape[0] == b_type.shape[b_idx]) else: a_idx = _get_check_index(self.transa, False, row_idx=-2, col_idx=-1) b_idx = _get_check_index(self.transb, True, row_idx=-2, col_idx=-1) type_check.expect(a_type.shape[a_idx] == b_type.shape[b_idx]) type_check.expect_broadcast_shapes( a_type.shape[:-2], b_type.shape[:-2])
def check_type_forward(self, in_types): type_check._argname(in_types, ('lhs', 'rhs')) type_check.expect( in_types[0].dtype == in_types[1].dtype, ) type_check.expect_broadcast_shapes( in_types[0].shape, in_types[1].shape)
def check_type_forward(self, in_types): type_check.expect(in_types.size() == 2) type_check.expect( in_types[0].dtype == in_types[1].dtype, ) type_check.expect_broadcast_shapes( in_types[0].shape, in_types[1].shape)
def check_type_forward(self, in_types): type_check._argname(in_types, ('a', 'b')) a_type, b_type = in_types type_check.expect( a_type.dtype.kind == 'f', b_type.dtype.kind == 'f', a_type.ndim >= 1, b_type.ndim >= 1, ) a_ndim = type_check.eval(a_type.ndim) b_ndim = type_check.eval(b_type.ndim) if b_ndim == 1: a_idx = -2 if self.transa and a_ndim > 1 else -1 type_check.expect(a_type.shape[a_idx] == b_type.shape[0]) elif a_ndim == 1: b_idx = -1 if self.transb and b_ndim > 1 else -2 type_check.expect(a_type.shape[0] == b_type.shape[b_idx]) else: a_idx = _get_check_index(self.transa, False, row_idx=-2, col_idx=-1) b_idx = _get_check_index(self.transb, True, row_idx=-2, col_idx=-1) type_check.expect(a_type.shape[a_idx] == b_type.shape[b_idx]) type_check.expect_broadcast_shapes( a_type.shape[:-2], b_type.shape[:-2])
def check_type_forward(self, in_types): type_check._argname(in_types, ('x1', 'x2')) type_check.expect( in_types[0].dtype.kind == 'f', in_types[0].dtype == in_types[1].dtype, ) type_check.expect_broadcast_shapes(in_types[0].shape, in_types[1].shape)
def check_type_forward(self, in_types): type_check._argname(in_types, ('x1', 'x2')) type_check.expect( in_types[0].dtype.kind == 'f', in_types[0].dtype == in_types[1].dtype, ) type_check.expect_broadcast_shapes( in_types[0].shape, in_types[1].shape)
def check_type_forward(self, in_types): type_check.expect(in_types.size() == 2) x_type, y_type = in_types condition = self.condition type_check.expect( condition.dtype == numpy.bool_, x_type.dtype == y_type.dtype, ) type_check.expect_broadcast_shapes( condition.shape, x_type.shape, y_type.shape)
def check_type_forward(self, in_types): type_check._argname(in_types, ('x', 'y')) x_type, y_type = in_types condition = type_check._make_variable_from_array( # allow scalar `condition` chainer.utils.force_array(self.condition), 'condition') type_check.expect( condition.dtype == numpy.bool_, x_type.dtype == y_type.dtype, ) type_check.expect_broadcast_shapes(condition.shape, x_type.shape, y_type.shape)
def check_type_forward(self, in_types): type_check.expect(in_types.size() > 0) shapes = [t.shape for t in in_types] type_check.expect_broadcast_shapes(*shapes)
def check_type_forward(self, in_types): type_check.expect(in_types.size() > 0) shapes = [t.shape for t in in_types] type_check.expect_broadcast_shapes(*shapes)