CLIP icon indicating copy to clipboard operation
CLIP copied to clipboard

Fixed documentation for Zero-Shot Prediction

Open apkuhar opened this issue 2 years ago • 2 comments

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

apkuhar avatar Jan 27 '23 00:01 apkuhar

dim=1 and dim=-1 are the same

shinian-023 avatar Feb 16 '23 12:02 shinian-023

@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 https://github.com/openai/CLIP/blob/a9b1bf5920416aaeaec965c25dd9e8f98c864f16/clip/model.py#L363

apkuhar avatar Feb 27 '23 04:02 apkuhar