Question about a module that does not required grad
See original GitHub issueThanks for the wonderful library!
I have one question about how to use higher.
I want to train the network with second order derivative,
but some parts of network (such as nn.Embedding ) are frozen.
something like this
net= Net()
param = filter(lambda x: x.requires_grad, model.parameters())
inner_opt = torch.optim.SGD(param, lr=1e-1)
with higher.innerloop_ctx(net, inner_opt, copy_initial_weights=False) as (fnet, diffopt):
logits = net(batch_x)
loss = loss_fnt(logits, batch_y)
diffopt.step(loss)
but i got the error message “RuntimeError: One of the differentiated Tensors does not require grad”
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
python - element 0 of tensors does not require grad and ...
I reward agent if he's correct positive 1 or not negative -1 and computate loss FUNC with predicted_action(predicted_class) and reward. But I ...
Read more >Problem : RuntimeError: element 0 of tensors does not ...
Hi ! I am creating a ladder like autoencoder network for video prediction. I create 2 class : one for the encoder and...
Read more >What is the use of torch.no_grad in pytorch?
Use of Torch.no_grad() : To perform inference without Gradient Calculation. To make sure there's no leak test data into the model.
Read more >Entrance Counseling
Entrance counseling for graduate or professional students is required if you have not previously received a Direct Unsubsidized Loan or Direct PLUS Loan....
Read more >Frequently Asked Questions (FAQs) // Graduate School ...
Frequently Asked Questions (FAQs), Graduate School, Marquette University. ... Which Marquette graduate programs are not administered by the Graduate School?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
On my to-do list for tomorrow!
Fixed in #11. Please re-open if this does not address your issue.