What’s the correct way to handle num_outputs
in a custom model?
- it seems that the action space should be used to get the correct output size, so
num_outputs
seems redundant in that case. - It’s not passed in to the model initializer in some cases (and the last layer is just the flattened features in the examples), so I’m wondering what’s the logic behind that and in what scenarios the
if num_outputs
check is needed. - Wrappers change
num_outputs
in a somewhat confusing way, but I assume thenum_outputs
of the wrapper should be separate from the wrapped class’ one, e.g. fromLSTMWrapper
:
# Add prev-action/reward nodes to input to LSTM.
if self.use_prev_action:
self.num_outputs += self.action_dim
if self.use_prev_reward:
self.num_outputs += 1
self.lstm = nn.LSTM(
self.num_outputs, self.cell_size, batch_first=not self.time_major)
self.num_outputs = num_outputs