paulstarke/PhaseBetweener

The size of tensor a (823) must match the size of tensor b (784) at non-singleton dimension 1

dj-kefir-siorbacz opened this issue · 2 comments

https://github.com/pauzii/PhaseBetweener/blob/9d4956e33cc7d8e4b65c020a704dd9382d67af8a/DeepLearningONNX/Models/GNN/InBetweeningNetwork.py#L53-L54

Error related to #10 (comment)

Started creating data pointers...
Finished creating data pointers.
Warning: Number of gating features (130) and main features (693) are not the same as input features (784).
Traceback (most recent call last):
  File "/home/jupyter/DeepLearningONNX/Models/GNN/InBetweeningNetwork.py", line 106, in <module>
    yPred, gPred, w0, w1, w2 = network(xBatch)
  File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/jupyter/DeepLearningONNX/Models/GNN/../../../DeepLearningONNX/Models/GNN/InBetweeningNetwork.py", line 176, in forward
    x = utility.Normalize(x, self.Xnorm)
  File "/home/jupyter/DeepLearningONNX/Models/GNN/../../../DeepLearningONNX/Library/Utility.py", line 251, in Normalize
    return (X - mean) / std
RuntimeError: The size of tensor a (823) must match the size of tensor b (784) at non-singleton dimension 1

You'll need to change the index mapping depending on your export. Have a look at InputLabels.txt. Feed the phase features (#130) into the gating network and all other features into the motion prediction network.
In this example you might look for:

 gating_indices = torch.tensor([(654+ i) for i in range(130)]) #index where phase starts 
 main_indices = torch.tensor([(i) for i in range(654)])

If this doesn't work please post your InputLabels.txt here.

Yeah, I did it and it works!