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

fix: add runtime_shape argument in batchnorm-related classes to match… #804

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

euphoria0-0
Copy link

@euphoria0-0 euphoria0-0 commented Jan 23, 2024

This PR is related to issue #450 .
BatchNorm1dToQuantScaleBias would provide the same shape: (B, D) -> (B, D).

dim = 100
batch_norm = BatchNorm1dToQuantScaleBias(num_features=dim, runtime_shape=(1, -1))
inputs = torch.rand(size=(5, dim))
outputs = batch_norm(inputs)
print('Outputs:', outputs.shape)

Outputs: torch.Size([5, 100])

batch_norm = BatchNorm1dToQuantScaleBias(num_features=dim, runtime_shape=(1, -1, 1))
inputs = torch.rand(size=(5, dim, 32))
outputs = batch_norm(inputs)
print('Outputs:', outputs.shape)

Outputs: torch.Size([5, 100, 32])

@euphoria0-0 euphoria0-0 changed the base branch from master to dev January 24, 2024 01:05
@Giuseppe5
Copy link
Collaborator

Thanks, I will take a look at this!

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.

2 participants