knysfh commited on
Commit
5316bd9
1 Parent(s): d6fc33f

compress normalization func

Browse files
Files changed (1) hide show
  1. README.md +1 -2
README.md CHANGED
@@ -25240,8 +25240,7 @@ outputs = session.run(None, inputs)[0]
25240
 
25241
  # Apply mean pooling to 'outputs' to get a single representation of each text
25242
  embeddings = mean_pooling(outputs, input_text["attention_mask"])
25243
- norm = np.linalg.norm(embeddings, ord=2, axis=1, keepdims=True)
25244
- embeddings = embeddings / norm
25245
  ```
25246
 
25247
  </p>
 
25240
 
25241
  # Apply mean pooling to 'outputs' to get a single representation of each text
25242
  embeddings = mean_pooling(outputs, input_text["attention_mask"])
25243
+ embeddings = embeddings / np.linalg.norm(embeddings, ord=2, axis=1, keepdims=True)
 
25244
  ```
25245
 
25246
  </p>