Skip to content

Commit

Permalink
chore: update encoding len
Browse files Browse the repository at this point in the history
  • Loading branch information
Anush008 committed Jan 31, 2024
1 parent 770a12e commit df7e636
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fastembed.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (f *FlagEmbedding) onnxEmbed(input []string) ([]([]float32), error) {
inputTypeIdsFlat = append(inputTypeIdsFlat, inputTypeIds...)
}

inputShape := ort.NewShape(int64(len(inputs)), int64(f.maxLength))
inputShape := ort.NewShape(int64(len(inputs)), int64(encodings[0].Len()))

inputTensorID, err := ort.NewTensor(inputShape, inputIdsFlat)
if err != nil {
Expand All @@ -175,7 +175,7 @@ func (f *FlagEmbedding) onnxEmbed(input []string) ([]([]float32), error) {
return nil, err
}

outputShape := ort.NewShape(int64(len(inputs)), int64(f.maxLength), int64(modelInfo.Dim))
outputShape := ort.NewShape(int64(len(inputs)), int64(int64(encodings[0].Len())), int64(modelInfo.Dim))
outputTensor, err := ort.NewEmptyTensor[float32](outputShape)
if err != nil {
return nil, err
Expand Down

0 comments on commit df7e636

Please sign in to comment.