Skip to content

Commit

Permalink
gpu_bindings_test.go: replace fmt.Print with t.Log
Browse files Browse the repository at this point in the history
Didn't know t.Log existed, better to use it.
  • Loading branch information
uhbuhb committed Sep 29, 2021
1 parent 0c3bb82 commit fa56e63
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions gpu_bindings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package faiss

import (
"fmt"
"github.com/stretchr/testify/require"
"testing"
)
Expand All @@ -23,7 +22,7 @@ func TestFlatIndexOnGpuFunctionality(t *testing.T) {
require.Nil(t, err)
require.Equal(t, int64(len(vectorsToAdd)), gpuIdx.Ntotal())

fmt.Println(distances, resultIds, err)
t.Log(distances, resultIds, err)
for i := range vectorsToAdd {
require.Equal(t, int64(i), resultIds[len(vectorsToAdd)*i])
require.Zero(t, distances[len(vectorsToAdd)*i])
Expand Down Expand Up @@ -60,8 +59,8 @@ func TestIndexIDMapOnGPU(t *testing.T) {

distances, resultIds, err := gpuIndex.Search(vectorsToAdd, 5)
require.Nil(t, err)
fmt.Println(gpuIndex.D(), gpuIndex.Ntotal())
fmt.Println(distances, resultIds, err)
t.Log(gpuIndex.D(), gpuIndex.Ntotal())
t.Log(distances, resultIds, err)
for i := range vectorsToAdd {
require.Equal(t, ids[i], resultIds[len(vectorsToAdd)*i])
require.Zero(t, distances[len(vectorsToAdd)*i])
Expand Down Expand Up @@ -97,7 +96,7 @@ func TestTransferToGpuAndBack(t *testing.T) {

require.Equal(t, int64(4), gpuIndex.Ntotal())
distances2, resultIds2, err := gpuIndex.Search([]float32{1}, 5)
fmt.Println(distances2, resultIds2, gpuIndex.Ntotal())
t.Log(distances2, resultIds2, gpuIndex.Ntotal())
require.Nil(t, err)
require.Equal(t, float32(1), distances2[0])

Expand All @@ -109,7 +108,7 @@ func TestTransferToGpuAndBack(t *testing.T) {
idsSelector, err = NewIDSelectorBatch([]int64{0})
cpuIndex.RemoveIDs(idsSelector)
distances2, resultIds2, err = cpuIndex.Search([]float32{1}, 5)
fmt.Println(distances2, resultIds2, cpuIndex.Ntotal())
t.Log(distances2, resultIds2, cpuIndex.Ntotal())
require.Nil(t, err)
require.Equal(t, float32(1), distances2[0])

Expand Down

0 comments on commit fa56e63

Please sign in to comment.