Skip to content

Conversation

apkuhar
Copy link

@apkuhar apkuhar commented Jan 27, 2023

norm must be done with dim=1 not dim=-1

norm must be done with dim=1 not dim=-1
@shinian-023
Copy link

dim=1 and dim=-1 are the same

@apkuhar
Copy link
Author

apkuhar commented Feb 27, 2023

@GentelmanTenyeaers
Not strictly, it depends on the number of dimensions of the input tensor.
The problem is if someone blindly copies the examples and modified it's for his own use, no realizing the -1 is not the intended dimension.

Plus the code internally actually uses dim=1

image_features = image_features / image_features.norm(dim=1, keepdim=True)

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