def __new__(cls, x, w, b, filter=3, stride=1, padding=0): filter, stride, padding = (tuplize(x) for x in (filter, stride, padding)) in_shape = x.shape[1:] out_shape = [w.shape[0]] out_shape.extend(out_size(x.shape[2:], filter, stride, padding)) return cls.calc_value(x, w, b, in_shape, out_shape, filter, stride, padding)
def __new__(cls, x, filter=3, stride=1, padding=0, ceil_mode=False): filter, stride, padding = (tuplize(x) for x in (filter, stride, padding)) in_shape = x.shape[1:] out_shape = [ x.shape[1], ] out_shape.extend( out_size(x.shape[2:], filter, stride, padding, ceil_mode=ceil_mode)) return cls.calc_value(x, in_shape, out_shape, filter, stride, padding)