|
|
|
|
|
|
for visual_size in visual_sizes: |
|
|
|
self.visual_encoders.append(visual_encoder(visual_size)) |
|
|
|
|
|
|
|
self.vector_encoders = nn.ModuleList(self.vector_encoders) |
|
|
|
self.visual_encoders = nn.ModuleList(self.visual_encoders) |
|
|
|
if use_lstm: |
|
|
|
self.lstm = nn.LSTM(h_size, h_size, 1) |
|
|
|
|
|
|
|
|
|
|
use_lstm, |
|
|
|
): |
|
|
|
super(Critic, self).__init__() |
|
|
|
self.stream_names = stream_names |
|
|
|
self.network_body = NetworkBody( |
|
|
|
vector_sizes, |
|
|
|
visual_sizes, |
|
|
|
|
|
|
vis_encode_type, |
|
|
|
use_lstm, |
|
|
|
) |
|
|
|
self.stream_names = stream_names |
|
|
|
self.value_heads = ValueHeads(stream_names, h_size) |
|
|
|
|
|
|
|
def forward(self, vec_inputs, vis_inputs): |
|
|
|
|
|
|
for name in stream_names: |
|
|
|
value = nn.Linear(input_size, 1) |
|
|
|
self.value_heads[name] = value |
|
|
|
self.value_heads = nn.ModuleDict(self.value_heads) |
|
|
|
|
|
|
|
def forward(self, hidden): |
|
|
|
value_outputs = {} |
|
|
|
|
|
|
for _ in range(num_layers - 1): |
|
|
|
self.layers.append(nn.Linear(hidden_size, hidden_size)) |
|
|
|
self.layers.append(nn.ReLU()) |
|
|
|
self.layers = nn.ModuleList(self.layers) |
|
|
|
|
|
|
|
def forward(self, inputs): |
|
|
|
x = inputs |
|
|
|