We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
A short description about the bug/issue
# import oneflow as flow # import oneflow.nn as nn import torch as flow import torch.nn as nn class N1(nn.Module): def __init__(self): super(N1, self).__init__() self.reduction = nn.Linear(96, 96, bias=False) self.norm = nn.LayerNorm(96) def forward(self, x): x = self.norm(x) x = self.reduction(x) return x n_flow = N1().cuda() x = flow.rand(2, 96).cuda() label = flow.rand(2, 96).cuda() loss_fn = nn.MSELoss() # loss_fn = nn.BCELoss() optimizer = flow.optim.SGD(n_flow.parameters(), lr=0.001, momentum=0.9, weight_decay=0.05) for i in range(2): optimizer.zero_grad() y = n_flow(x) loss_fn(y, label).backward() optimizer.step() print(y)
Traceback (most recent call last): File "/home/kaijie/Documents/code/of/large_scale_training/large_scale_training/swin_transformer/bug3.py", line 27, in <module> loss_fn(y, label).backward() File "/home/kaijie/anaconda3/envs/torch_cuda10_1/lib/python3.8/site-packages/oneflow/framework/tensor.py", line 80, in _backward flow.autograd.backward(self, gradient, retain_graph, create_graph) File "/home/kaijie/anaconda3/envs/torch_cuda10_1/lib/python3.8/site-packages/oneflow/autograd/autograd.py", line 48, in backward backward_api( IndexError: vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)
python3 -m oneflow --doctor
The text was updated successfully, but these errors were encountered:
先norm再linear就有问题
先linear再norm就没上述问题
TODO
Sorry, something went wrong.
IndexError: vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)
这个错误是哪一段c++代码报出来的呢?看起来需要增加下检查,这个index越界导致直接没有错误栈了
Successfully merging a pull request may close this issue.
Summary
A short description about the bug/issue
Code to reproduce bug
报错信息
System Information
python3 -m oneflow --doctor
):The text was updated successfully, but these errors were encountered: