Comments (3)
import torch
from torch import nn
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.w = torch.rand(2, 2)
self.w.requires_grad = True
def forward(self, x):
return self.w*x
net = Net()
net(torch.rand(2, 2))
tensor([[0.0726, 0.2216],
[0.3548, 0.8168]], grad_fn=<MulBackward0>)
list(net.parameters())
[]
net.w.requires_grad
True
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.w = nn.Parameter(torch.rand(2, 2))
def forward(self, x):
return self.w*x
net = Net()
list(net.parameters())
[Parameter containing:
tensor([[0.8596, 0.7057],
[0.6475, 0.5657]], requires_grad=True)]
from convolutional_lstm_pytorch.
You are right, plz refer to convLSTM.py#L14 which states the reason.
from convolutional_lstm_pytorch.
Thank you for your comment. I am new to pytorch and your explanation is not very clear for me, can you elaborate on that? To my knowledge nn.Parameters are included in model.parameters()
so that they are updated with each call of optimizer.step()
(what do you mean by forever?) I suppose that Wci,Wcf,Wco
also should be trainable in the network.
Paper for convlstm : https://arxiv.org/abs/1506.04214
and your explaination,
-if using requires_grad flag, torch.save will not save parameters in deed although it may be updated every epoch.
-Howerver, if you use declare an optimizer like Adam(model.parameters()),
-parameters will not be updated forever.
Thank you
from convolutional_lstm_pytorch.
Related Issues (20)
- using for custom dataset HOT 1
- Is there any experiments results provided?
- Found the code is much slower than Keras counterpart (takes 2-3 times longer time). Do you know why?
- What's the shape of input? HOT 1
- I think forward code is wrong
- Input shape issue and lack of bias. HOT 9
- The shape of the output
- Where is the squence length HOT 1
- why hidden_channels % 2 == 0 ?
- Error in backward HOT 1
- Peephole connections (Wci, Wcf, Wco) gradient update HOT 1
- Why self.num_features=4 in line 15?
- How can I use this module for predicting the moving mnist like the paper? HOT 1
- about concat HOT 5
- about forward HOT 1
- RuntimeError: Jacobian mismatch for output 0 with respect to input 0 HOT 3
- 关于input 和 step 的问题 HOT 2
- How to do the entire sequence all at once?
- Why Wci,Wcf,Wco should be initialized at the beginning of each batch? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from convolutional_lstm_pytorch.