Hi Aysuda!



 aysuda:

I have a PPO agent and give it a tensor of size (1, 128, 100) as input (state).
The state of the environment is a numpy array (128, 100) and then convert to tensor.
…
state_dim = env.observation_space.shape[0]  #128
        self.action_layer = nn.Sequential(
            nn.Linear(state_dim, hidden_dim),
            ...



It’s not clear to me what you’re passing into your model.
Please check the shape of the state that gets passed into your
instance of Actor (so then into action_layer).  state must be
a tensor of shape [nBatch, 128]; it can’t be a 3-d tensor nor a
tensor of shape [128, some_other_dim].
[Edit:  To clarify:  state could be a 3-d tensor, just not of shape
[1, 128, 100].  Examples of legal 3-d shapes would be
[1, 100, 128] and [100, 17, 128].  The requirement is that
the trailing dimension match the value of in_features = 128
of the Linear.]
Best.
K. Frank