MCPcopy Create free account
hub / github.com/BIT-MCS/DRL-eFresh / VisionNetwork

Class VisionNetwork

utils/spatial_att_github.py:151–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149
150
151class VisionNetwork(nn.Module):
152 def __init__(self):
153 super(VisionNetwork, self).__init__()
154 self.vision_cnn = nn.Sequential(
155 nn.Conv2d(
156 in_channels=3,
157 out_channels=32,
158 kernel_size=(8, 8),
159 stride=4,
160 padding=1, # Padding s.t. the output shapes match the paper.
161 ),
162 nn.Conv2d(
163 in_channels=32,
164 out_channels=64,
165 kernel_size=(4, 4),
166 stride=2,
167 padding=2, # Padding s.t. the output shapes match the paper.
168 ),
169 )
170 self.vision_lstm = ConvLSTMCell(
171 input_channels=64, hidden_channels=128, kernel_size=3
172 )
173
174 def reset(self):
175 self.vision_lstm.reset()
176
177 def forward(self, X):
178 X = X.transpose(1, 3)
179 O, _ = self.vision_lstm(self.vision_cnn(X))
180 return O.transpose(1, 3)
181
182
183class QueryNetwork(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected