Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ODE计算代码问题 #9

Open
jinguangyin opened this issue Nov 2, 2021 · 3 comments
Open

ODE计算代码问题 #9

jinguangyin opened this issue Nov 2, 2021 · 3 comments

Comments

@jinguangyin
Copy link

请问代码中的这段有详细解释吗?确保特征值小于1为什么这么做,为什么不是直接乘上一个可学习参数?
d = torch.clamp(self.d, min=0, max=1) w = torch.mm(self.w * d, torch.t(self.w)) w = (1 + self.beta) * w - self.beta * torch.mm(torch.mm(w, torch.t(w)), w) xw = torch.einsum('ijkl, lm->ijkm', x, w) d2 = torch.clamp(self.d2, min=0, max=1) w2 = torch.mm(self.w2 * d2, torch.t(self.w2)) w2 = (1 + self.beta) * w2 - self.beta * torch.mm(torch.mm(w2, torch.t(w2)), w2) xw2 = torch.einsum('ijkl, km->ijml', x, w2)

@jiangxinke
Copy link

TypeError: cannot assign 'torch.cuda.FloatTensor' as parameter 'w' (torch.nn.Parameter or None expected)

@square-coder
Copy link
Owner

square-coder commented Jan 18, 2022 via email

@jiangxinke
Copy link

There is a bug in ODEFnc(), for the Parameter can not be augmented assignment directly, or else it would have an error "cannot assign ‘torch.cuda.FloatTensor’ as parameter ‘self.w’ (torch.nn.Parameter or None expected)"

it should be :

    self.w.data = (1 + self.beta) * self.w - self.beta * torch.mm(torch.mm(self.w, torch.t(self.w)), self.w)
    xw = torch.einsum('ijkl, lm->ijkm', x, w)

    d2 = torch.clamp(self.d2, min=0, max=1)
    w2 = torch.mm(self.w2 * d2, torch.t(self.w2))
    self.w2.data = (1 + self.beta) * self.w2 - self.beta * torch.mm(torch.mm(self.w2, torch.t(self.w2)), self.w2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants