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

FloatTensor does not initialize tensor #12

Open
popiol opened this issue Jul 31, 2022 · 1 comment
Open

FloatTensor does not initialize tensor #12

popiol opened this issue Jul 31, 2022 · 1 comment

Comments

@popiol
Copy link

popiol commented Jul 31, 2022

In AVWGCN.init there are those lines:

        self.weights_pool = nn.Parameter(torch.FloatTensor(embed_dim, cheb_k, dim_in, dim_out))
        self.bias_pool = nn.Parameter(torch.FloatTensor(embed_dim, dim_out))

Like this, the FloatTensor constructor does not initialize the values in the tensor, so it's just some garbage. It might lead to nan values and break the whole training. It should be initialized with some values, zeros / ones / rand... anything.

@P-PPPPP
Copy link

P-PPPPP commented Oct 6, 2023

FloatTensor 只创建了一个empty tensor, 有时候里面可能含有Nan. 这种时候如果在loss function里面做了Mask 'Nan', 评价指标就会全成0.
torch.FloatTensor(xxx) -> torch.randn(xxx).

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

2 participants