Skip to content

w,v从哪里来 #1

@qqxze

Description

@qqxze

您好, # FM part 1st order layer
self.w = self.params.get('w', grad_req='write', shape=(self._feature_dim, 1))

        # FM part 2nd order vector
        self.v = self.params.get('v', grad_req='write', shape=(self._feature_dim, k_units))

def hybrid_forward(self, F, x,w, v):
    x_broadcast = x.reshape((-1, self._feature_dim, 1))
    # FM first order
    f1 = F.broadcast_mul(w, x_broadcast)
    f1 = F.sum(f1, axis=2)

    # FM 2nd order
    xv = F.broadcast_mul(v, x_broadcast)
    f2 = 0.5 * (F.square(F.sum(xv, axis=1)) - F.sum(F.square(xv), axis=1))
    f2 = F.Dropout(f2,p_drop)
    # DNN
    xv = F.flatten(xv) #shape=[-1,self._feature_dim*self._k_units])
    #print (xv.shape)
    for i in range(len(self._dnn_layers)):
        xv = self.denselayers[i](xv)
        xv = self.droplayers[i](xv)
    # concate all parts
    y = F.concat(xv, f1, f2, dim=1)
    y = self.densefinal(y)
    return y

在前馈网络中,w,v是由网络参数入口获得,但是在您train里边,net()里边送入的参数只有 x,没有w,v 并且self.w,self.v 您也并没有用到。所以,请问前馈网络中的w v到底是从哪里来的呐? 谢谢啦

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions