Skip to content

Conversation

@MarieRoald
Copy link
Contributor

Currently, tl.shape returns a tuple for most backends. However, with the PyTorch backend, it returns a torch.Size object, which can make it more difficult to make backend agnostic code. This pull request makes it return a tuple instead and adds a test that fails if the object returned from tl.shape is not a tuple.

Alternatively, if we don't want to cast the torch.Size to a tuple automatically, then we could add an optional as_tuple argument to all backends. However, I made it cast to a tuple since that is what's done in the TensorFlow backend.

@codecov
Copy link

codecov bot commented Jan 8, 2022

Codecov Report

Merging #357 (3dfaf2b) into main (87b435b) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #357   +/-   ##
=======================================
  Coverage   88.16%   88.16%           
=======================================
  Files         105      105           
  Lines        6058     6058           
=======================================
  Hits         5341     5341           
  Misses        717      717           
Impacted Files Coverage Δ
tensorly/decomposition/_cp.py 87.59% <0.00%> (-0.37%) ⬇️
tensorly/tenalg/proximal.py 67.38% <0.00%> (+0.23%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 87b435b...3dfaf2b. Read the comment docs.

Copy link
Contributor

@cohenjer cohenjer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems very reasonable to me !

@JeanKossaifi
Copy link
Member

Thanks @MarieRoald, looks good to me too, merging.

@JeanKossaifi JeanKossaifi merged commit 97702a7 into tensorly:main Feb 11, 2022
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.

3 participants