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

Empty args #5

Merged
merged 2 commits into from
Oct 12, 2023
Merged

Empty args #5

merged 2 commits into from
Oct 12, 2023

Conversation

percevalw
Copy link
Member

Description

Allow to use with no args, as a simple padding function :

ft = as_folded_tensor(
    [
        [0, 1, 2],
        [3, 4],
    ],
)
assert (
    ft.data
    == torch.tensor(
        [
            [0, 1, 2],
            [3, 4, 0],
        ]
    )
).all()
assert ft.data.dtype == torch.int64
assert (
    ft.mask
    == torch.tensor(
        [
            [1, 1, 1],
            [1, 1, 0],
        ]
    ).bool()
).all()

Checklist

  • If this PR is a bug fix, the bug is documented in the test suite.
  • Changes were documented in the changelog (pending section).
  • If necessary, changes were made to the documentation.

@codecov
Copy link

codecov bot commented Oct 11, 2023

Codecov Report

All modified lines are covered by tests ✅

Files Coverage Δ
foldedtensor/__init__.py 100.00% <100.00%> (ø)

📢 Thoughts on this report? Let us know!.

@percevalw percevalw merged commit f52c932 into main Oct 12, 2023
13 checks passed
@percevalw percevalw deleted the empty-args branch October 12, 2023 00:01
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