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

Expand low/high in ZBox to improve usability #101

Merged
merged 1 commit into from
Jan 19, 2022
Merged

Conversation

chr5tphr
Copy link
Owner

  • add zennit.core.expand, which expands tensors to a shape, in a more
    lenient fashion than simply torch.expand:
    • allow scalars (0-dim tensor or float/int)
    • assume trailing dimensions to be singleton if number of dimensions
      is smaller than target number of timensions
    • [backwards-compatibility] cut first (batch) dimension to shape
      if the supplied first dimension is larger (only if cut_batch_dim
      flag is set True)
  • use expand in zennit.rules.ZBox to expand low and high

- add zennit.core.expand, which expands tensors to a shape, in a more
  lenient fashion than simply torch.expand:
    - allow scalars (0-dim tensor or float/int)
    - assume trailing dimensions to be singleton if number of dimensions
      is smaller than target number of timensions
    - [backwards-compatibility] cut first (batch) dimension to `shape`
      if the supplied first dimension is larger (only if cut_batch_dim
      flag is set True)
- use expand in zennit.rules.ZBox to expand `low` and `high`
@chr5tphr chr5tphr merged commit 0406fd8 into master Jan 19, 2022
@chr5tphr chr5tphr deleted the zbox-better-expand branch January 19, 2022 16:49
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