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, index, filter, stride, padding): filter, stride, padding = (tuplize(x) for x in (filter, stride, padding)) in_shape = x.shape[1:] out_shape = [ x.shape[1], ] out_shape.extend( transpose_out_size(in_shape[1:], filter, stride, padding)) return cls.calc_value(x, index, 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)
def __init__(self, channel=32, filter=3, padding=0, stride=1, input_size=None, initializer=GlorotNormal()): self._padding, self._stride, self._kernel = (tuplize(x) for x in (padding, stride, filter)) self._channel = channel self._initializer = initializer super(Conv2d, self).__init__(input_size)
def __new__(cls, x, w, b, filter=3, stride=1, padding=0, dilation=1): filter, stride, padding, dilation = (tuplize(x) for x in (filter, stride, padding, dilation)) in_shape = x.shape[1:] out_shape = [ w.shape[1], ] out_shape.extend( transpose_out_size(in_shape[1:], filter, stride, padding, dilation)) return cls.calc_value(x, w, b, in_shape, out_shape, filter, stride, padding, dilation)
def __init__(self, channel=32, filter=3, padding=0, stride=1, dilation=1, input_size=None, ignore_bias=False, initializer=GlorotNormal(), weight_decay=0): self._padding, self._stride, self._kernel, self._dilation = ( tuplize(x) for x in (padding, stride, filter, dilation)) self._channel = channel self._ignore_bias = ignore_bias self._initializer = initializer self._weight_decay = weight_decay super(Conv2d, self).__init__(input_size)
def __init__(self, channel=32, filter=3, padding=0, stride=1, dilation=1, groups=1, input_size=None, ignore_bias=False, initializer=GlorotNormal(), weight_decay=0): self._padding, self._stride, self._kernel, self._dilation = ( tuplize(x) for x in (padding, stride, filter, dilation)) self._channel = channel self._groups = groups #print("self._groups: ", self._groups) assert isinstance( self._groups, int ) and self._groups > 0, "Please set groups to integer greater than 0" self._ignore_bias = ignore_bias self._initializer = initializer self._weight_decay = weight_decay super(GroupConv2d, self).__init__(input_size)
def __init__(self, filter=3, padding=0, stride=1, ceil_mode=False): self._padding, self._stride, self._kernel = (tuplize(x) for x in (padding, stride, filter)) self._ceil_mode = ceil_mode
def __init__(self, filter=3, padding=0, stride=1): self._padding, self._stride, self._kernel = (tuplize(x) for x in (padding, stride, filter))