How to approach when models output more than one tensor #135
-
Hello everyone, I see that one of the open issues touches upon the topic of multiple output tensors from pytorch models #3 . I have a model which is expecting 5 tensors in the forward function and outputs 2 tensors of different shape (namely scalar, and 2D shaped tensors) Is there anything I could do at this moment to properly handle this situation? Thanks in advance, |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Thanks for asking Ivan! This is something we have an open issue for in #3 I am currently on leave and will be back in a week, but I will also make my colleagues aware of this discussion. |
Beta Was this translation helpful? Give feedback.
-
Unfortunately I am relatively new to both Fortran and libtorch so I am not not confident I would be able to contribute meaningfully. I tried the "dumb" idea of just scripting two instances of the model, one giving scalar, the other 2D shaped tensor. The unfortunate thing is that scalar is energy and 2D array is force. One gets force as a gradient of an energy, but I ran into an another active issue #131 :( I am not sure how complicated these problems really are. If you think they are solvable in reasonably short amount of time I would be more than happy to be guided toward general direction of what should be done, and at least try. Thanks a lot for a quick response! |
Beta Was this translation helpful? Give feedback.
-
@IZugec We have now merged the updates to add the ability for multiple outputs. If this works for you please could you select an answer and close the discussion? |
Beta Was this translation helpful? Give feedback.
-
Works perfectly. Thanks a bunch for such a swift update!! |
Beta Was this translation helpful? Give feedback.
@IZugec We have now merged the updates to add the ability for multiple outputs.
Please check the latest version of the code, examples, and documentation to see this.
If this works for you please could you select an answer and close the discussion?
Otherwise please feel free to ask further questions.