Skip to content

Allow flexible returns from a forward function.#940

Open
maxwest-uw wants to merge 13 commits into
mainfrom
issue/858
Open

Allow flexible returns from a forward function.#940
maxwest-uw wants to merge 13 commits into
mainfrom
issue/858

Conversation

@maxwest-uw
Copy link
Copy Markdown
Collaborator

Change Description

resolves #858

hyrax users can now return a dict of torch.Tensors from a model's forward function.

Solution Description

  • change is backwards compatible (i.e. user can return either a dict or a tensor from the forward function and everything should still work)
  • in cases where the forward function just returns a tensor, the data will eventually be converted into a dict with the format { "data": <tensor> }, which is how the data will eventually be saved to lance db anyway.
  • ResultDataset should now always return a dict with the data for a give index or set of indices
  • in cases throughout the data processing pipeline where we assume that a result is going to be a tensor, we have added a new function ResultDataset.get_combined_tensor, which for a given index or list of indices will return a concatenated and flattened tensor of all the available data keys.

Code Quality

  • I have read the Contribution Guide and agree to the Code of Conduct
  • My code follows the code style of this project
  • My code builds (or compiles) cleanly without any errors or warnings
  • My code contains relevant comments and necessary documentation

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.

Allow more flexible returns from forward

1 participant