Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytorch: implement input port function execution #3146

Merged
merged 3 commits into from
Dec 19, 2024

Conversation

kmantel
Copy link
Collaborator

@kmantel kmantel commented Dec 17, 2024

This implements the use in pytorch of the actual Functions assigned to
the input ports. When the pytorch-equivalent of a psyneulink Function
(via _gen_pytorch_fct) is unavailable, an error is thrown.

def _get_pytorch_function(obj, device, context):
pytorch_fct = getattr(obj, '_gen_pytorch_fct', None)
if pytorch_fct is None:
from psyneulink.library.compositions.autodiffcomposition import AutodiffCompositionError

Check notice

Code scanning / CodeQL

Cyclic import Note

Import of module
psyneulink.library.compositions.autodiffcomposition
begins an import cycle.
Copy link

This PR causes the following changes to the html docs (ubuntu-latest-3.11):

No differences!

...

See CI logs for the full diff.

Copy link

This PR causes the following changes to the html docs (ubuntu-latest-3.11):

No differences!

...

See CI logs for the full diff.

Previously, pytorch Mechansims would only use the equivalent of a
SUM LinearCombination for each of their input ports.

This implements the use in pytorch of the actual Functions assigned to
the input ports. When the pytorch-equivalent of a psyneulink Function
(via _gen_pytorch_fct) is unavailable, an error is thrown.
Copy link

This PR causes the following changes to the html docs (ubuntu-latest-3.11):

No differences!

...

See CI logs for the full diff.

@kmantel kmantel merged commit cedcae9 into PrincetonUniversity:devel Dec 19, 2024
36 checks passed
@kmantel kmantel deleted the pytorch-inputs branch December 19, 2024 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant