コード例 #1
0
    def __init__(self, n_filter, filter_size, stride=1, pad=0):
        self.FN = n_filter
        self.FH = filter_size[0]
        self.FW = filter_size[1]

        self.W = None  #.astype(np.float32)
        self.b = None  #.astype(np.float32)
        self.stride = stride
        self.pad = pad

        # 中間データ(backward時に使用)
        self.x = None
        self.col = None
        self.col_W = None

        # 重み・バイアスパラメータの勾配
        self.dW = None
        self.db = None

        self.xp = None

        name = 'conv'
        self.name = ut.naming(name, names)
        names.append(self.name)

        self.params = {}
        self.params['W_' + self.name] = self.W
        self.params['b_' + self.name] = self.b
        self.grads = {}
        self.grads['W_' + self.name] = self.dW
        self.grads['b_' + self.name] = self.db
コード例 #2
0
    def __init__(self, W, b, stride=1, pad=0):
        self.W = W  #.astype(np.float32)
        self.b = b  #.astype(np.float32)
        self.stride = stride
        self.pad = pad

        # 中間データ(backward時に使用)
        self.x = None
        self.col = None
        self.col_W = None

        # 重み・バイアスパラメータの勾配
        self.dW = None
        self.db = None

        self.xp = None

        name = 'conv'
        self.name = ut.naming(name, names)
        names.append(self.name)

        #        self.params = {}
        #        self.params['W_' + self.name] = self.W
        #        self.params['b_' + self.name] = self.b
        self.grads = {}
        self.grads['W_' + self.name] = self.dW
        self.grads['b_' + self.name] = self.db
コード例 #3
0
    def __init__(self):
        self.x_shape = None

        name = 'Flatten'
        self.name = ut.naming(name, names)
        names.append(self.name)

        self.params = {}
        self.grads = {}
コード例 #4
0
    def __init__(self):
        self.mask = None

        name = 'ReLU'
        self.name = ut.naming(name, names)
        names.append(self.name)

        self.params = {}
        self.grads = {}
コード例 #5
0
    def __init__(self):
        self.y = None
        self.t = None

        name = 'Mean_squared_error'
        self.name = ut.naming(name, names)
        names.append(self.name)

        self.params = {}
        self.grads = {}
コード例 #6
0
    def __init__(self):
        self.y = None
        self.t = None

        name = 'Softmax_cross_entropy'
        self.name = ut.naming(name, names)
        names.append(self.name)

        self.params = {}
        self.grads = {}
コード例 #7
0
    def __init__(self, ratio=0.5):
        self.ratio = ratio
        self.mask = None

        self.xp = None

        name = 'Dropout'
        self.name = ut.naming(name, names)
        names.append(self.name)

        self.params = {}
        self.grads = {}
コード例 #8
0
    def __init__(self, alpha=1.0):
        self.mask = None
        self.alpha = alpha
        self.y = None

        self.xp = None

        name = 'ELU'
        self.name = ut.naming(name, names)
        names.append(self.name)

        self.params = {}
        self.grads = {}
コード例 #9
0
    def __init__(self, pool_h, pool_w, stride=1, pad=0):
        self.pool_h = pool_h
        self.pool_w = pool_w
        self.stride = stride
        self.pad = pad

        self.x = None
        self.arg_max = None

        self.xp = None

        name = 'MaxPooling'
        self.name = ut.naming(name, names)
        names.append(self.name)

        self.params = {}
        self.grads = {}
コード例 #10
0
    def __init__(self, variational=False):
        self.y = None
        self.t = None
        self.l1 = None
        self.l2 = None
        self.dl1 = None
        self.dl2 = None
        self.variational = variational

        name = 'Softmax_cross_entropy'
        self.name = ut.naming(name, names)
        names.append(self.name)

        self.params = {}
        self.grads = {}
        self.params['l1_' + self.name] = 0  # self.l1
        self.params['l2_' + self.name] = 0  # self.l2
        self.grads['l1_' + self.name] = 0  # self.dl1
        self.grads['l2_' + self.name] = 0  # self.dl2
コード例 #11
0
    def __init__(self):
        self.eps = 1e-5
        self.gamma = None
        self.beta = None
        self.dgamma = None
        self.dbeta = None

        self.xp = None

        name = 'bn'
        self.name = ut.naming(name, names)
        names.append(self.name)

        self.params = {}
        self.params['g_' + self.name] = self.gamma
        self.params['b_' + self.name] = self.beta
        self.grads = {}
        self.grads['g_' + self.name] = self.dgamma
        self.grads['b_' + self.name] = self.dbeta
コード例 #12
0
    def __init__(self, alpha=1.6732632423543772, scale=1.0507009873554805):
        self.mask = None
        self.y = None
        self.alpha = alpha
        self.scale = scale
        self.dalpha = None
        self.dscale = None

        self.xp = None

        name = 'selu'
        self.name = ut.naming(name, names)
        names.append(self.name)

        #        self.params = {}
        #        self.params['a_' + self.name] = self.alpha
        #        self.params['s_' + self.name] = self.scale
        self.grads = {}
        self.grads['a_' + self.name] = self.dalpha
        self.grads['s_' + self.name] = self.dscale
コード例 #13
0
    def __init__(self, W, b):
        self.W = W  # .astype(np.float32)
        self.b = b  # .astype(np.float32)
        self.x = None

        self.dW = None
        self.db = None

        self.xp = None

        name = 'lin'
        self.name = ut.naming(name, names)
        names.append(self.name)

        #        self.params = {}
        #        self.params['W_' + self.name] = self.W
        #        self.params['b_' + self.name] = self.b
        self.grads = {}
        self.grads['W_' + self.name] = self.dW
        self.grads['b_' + self.name] = self.db
コード例 #14
0
    def __init__(self, output_size):
        self.output_size = output_size

        self.W = None  #.astype(np.float32)
        self.b = None  #.astype(np.float32)
        self.x = None

        self.dW = None
        self.db = None

        self.xp = None

        name = 'lin'
        self.name = ut.naming(name, names)
        names.append(self.name)

        self.params = {}
        self.params['W_' + self.name] = self.W
        self.params['b_' + self.name] = self.b
        self.grads = {}
        self.grads['W_' + self.name] = self.dW
        self.grads['b_' + self.name] = self.db