@@ -17,7 +17,7 @@ func TestCommand_TensorSet(t *testing.T) {
1717
1818 valuesInt8 := []int8 {1 }
1919 valuesInt16 := []int16 {1 }
20- valuesInt32 := []int {1 }
20+ valuesInt32 := []int64 {1 }
2121 valuesInt64 := []int64 {1 }
2222
2323 valuesUint8 := []uint8 {1 }
@@ -46,12 +46,12 @@ func TestCommand_TensorSet(t *testing.T) {
4646
4747 keyError1 := "test:TestCommand_TensorSet:1:FaultyDims"
4848
49- shp := []int {1 }
49+ shp := []int64 {1 }
5050
5151 type args struct {
5252 name string
5353 dt string
54- dims []int
54+ dims []int64
5555 data interface {}
5656 }
5757
@@ -78,7 +78,7 @@ func TestCommand_TensorSet(t *testing.T) {
7878
7979 {keyByte , args {keyByte , TypeUint8 , shp , valuesByte }, false },
8080
81- {keyError1 , args {keyError1 , TypeFloat , []int {1 , 10 }, []float32 {1 }}, true },
81+ {keyError1 , args {keyError1 , TypeFloat , []int64 {1 , 10 }, []float32 {1 }}, true },
8282 }
8383 for _ , tt := range tests {
8484 t .Run (tt .name , func (t * testing.T ) {
@@ -91,7 +91,7 @@ func TestCommand_TensorSet(t *testing.T) {
9191}
9292
9393func TestCommand_FullFromTensor (t * testing.T ) {
94- tensor := implementations .NewAiTensorWithShape ([]int {1 })
94+ tensor := implementations .NewAiTensorWithShape ([]int64 {1 })
9595 tensor .SetData ([]float32 {1.0 })
9696 client := createTestClient ()
9797 err := client .TensorSetFromTensor ("tensor1" , tensor )
@@ -101,7 +101,7 @@ func TestCommand_FullFromTensor(t *testing.T) {
101101 if diff := cmp .Diff (TypeFloat32 , gotResp [0 ]); diff != "" {
102102 t .Errorf ("TestCommand_FullFromTensor() mismatch (-want +got):\n %s" , diff )
103103 }
104- if diff := cmp .Diff ([]int {1 }, gotResp [1 ]); diff != "" {
104+ if diff := cmp .Diff ([]int64 {1 }, gotResp [1 ]); diff != "" {
105105 t .Errorf ("TestCommand_FullFromTensor() mismatch (-want +got):\n %s" , diff )
106106 }
107107 if diff := cmp .Diff ([]float32 {1.0 }, gotResp [2 ]); diff != "" {
@@ -149,8 +149,8 @@ func TestCommand_TensorGet(t *testing.T) {
149149 keyUint8 := "test:TensorGet:TypeUint8:1"
150150 keyUint16 := "test:TensorGet:TypeUint16:1"
151151
152- shp := []int {1 }
153- shpByteSlice := []int {1 , 5 }
152+ shp := []int64 {1 }
153+ shpByteSlice := []int64 {1 , 5 }
154154 simpleClient := createTestClient ()
155155 simpleClient .TensorSet (keyByteSlice , TypeUint8 , shpByteSlice , valuesByteSlice )
156156
@@ -173,7 +173,7 @@ func TestCommand_TensorGet(t *testing.T) {
173173 name string
174174 args args
175175 wantDt string
176- wantShape []int
176+ wantShape []int64
177177 wantData interface {}
178178 compareDt bool
179179 compareShape bool
@@ -222,7 +222,7 @@ func TestCommand_TensorGetBlob(t *testing.T) {
222222 keyByte := "test:TensorGetBlog:[]byte:1"
223223 keyUnexistant := "test:TensorGetMeta:Unexistant"
224224
225- shp := []int {1 , 4 }
225+ shp := []int64 {1 , 4 }
226226 simpleClient := Connect ("" , createPool ())
227227 simpleClient .TensorSet (keyByte , TypeInt8 , shp , valuesByte )
228228
@@ -233,7 +233,7 @@ func TestCommand_TensorGetBlob(t *testing.T) {
233233 name string
234234 args args
235235 wantDt string
236- wantShape []int
236+ wantShape []int64
237237 wantData []byte
238238 wantErr bool
239239 }{
@@ -279,7 +279,7 @@ func TestCommand_TensorGetMeta(t *testing.T) {
279279
280280 keyUnexistant := "test:TensorGetMeta:Unexistant"
281281
282- shp := []int {1 , 2 }
282+ shp := []int64 {1 , 2 }
283283 simpleClient := Connect ("" , createPool ())
284284 simpleClient .TensorSet (keyFloat32 , TypeFloat32 , shp , nil )
285285 simpleClient .TensorSet (keyFloat64 , TypeFloat64 , shp , nil )
@@ -299,7 +299,7 @@ func TestCommand_TensorGetMeta(t *testing.T) {
299299 name string
300300 args args
301301 wantDt string
302- wantShape []int
302+ wantShape []int64
303303 wantErr bool
304304 }{
305305 {keyFloat32 , args {keyFloat32 }, TypeFloat32 , shp , false },
@@ -354,8 +354,8 @@ func TestCommand_TensorGetValues(t *testing.T) {
354354 keyUint16 := "test:TensorGetValues:TypeUint16:1"
355355 keyUnexistant := "test:TensorGetValues:Unexistant"
356356
357- shp := []int {1 }
358- shp2 := []int {1 , 5 }
357+ shp := []int64 {1 }
358+ shp2 := []int64 {1 , 5 }
359359 simpleClient := Connect ("" , createPool ())
360360 simpleClient .TensorSet (keyFloat32 , TypeFloat32 , shp2 , valuesFloat32 )
361361 simpleClient .TensorSet (keyFloat64 , TypeFloat64 , shp , valuesFloat64 )
@@ -375,7 +375,7 @@ func TestCommand_TensorGetValues(t *testing.T) {
375375 name string
376376 args args
377377 wantDt string
378- wantShape []int
378+ wantShape []int64
379379 wantData interface {}
380380 wantErr bool
381381 }{
@@ -574,12 +574,12 @@ func TestCommand_ModelRun(t *testing.T) {
574574 return
575575 }
576576
577- errortset := simpleClient .TensorSet (keyTransaction1 , TypeFloat , []int {1 , 30 }, nil )
577+ errortset := simpleClient .TensorSet (keyTransaction1 , TypeFloat , []int64 {1 , 30 }, nil )
578578 if errortset != nil {
579579 t .Error (errortset )
580580 }
581581
582- errortsetReference := simpleClient .TensorSet (keyReference1 , TypeFloat , []int {256 }, nil )
582+ errortsetReference := simpleClient .TensorSet (keyReference1 , TypeFloat , []int64 {256 }, nil )
583583 if errortsetReference != nil {
584584 t .Error (errortsetReference )
585585 }
@@ -848,9 +848,9 @@ func TestCommand_Info(t *testing.T) {
848848 assert .Equal (t , BackendTF , info ["backend" ])
849849 assert .Equal (t , "0" , info ["calls" ])
850850
851- err = c .TensorSet ("a" , TypeFloat32 , []int {1 }, []float32 {1.1 })
851+ err = c .TensorSet ("a" , TypeFloat32 , []int64 {1 }, []float32 {1.1 })
852852 assert .Nil (t , err )
853- err = c .TensorSet ("b" , TypeFloat32 , []int {1 }, []float32 {4.4 })
853+ err = c .TensorSet ("b" , TypeFloat32 , []int64 {1 }, []float32 {4.4 })
854854 assert .Nil (t , err )
855855 err = c .ModelRun (keyModel1 , []string {"a" , "b" }, []string {"mul" })
856856 assert .Nil (t , err )
@@ -878,7 +878,7 @@ func TestCommand_DagRun(t *testing.T) {
878878 return
879879 }
880880 err = c .ModelSet (keyModel1 , BackendTF , DeviceCPU , data , []string {"a" , "b" }, []string {"mul" })
881- err = c .TensorSet ("persisted_tensor_1" , TypeFloat32 , []int {1 , 2 }, []float32 {5 , 10 })
881+ err = c .TensorSet ("persisted_tensor_1" , TypeFloat32 , []int64 {1 , 2 }, []float32 {5 , 10 })
882882 assert .Nil (t , err )
883883
884884 type args struct {
@@ -891,12 +891,12 @@ func TestCommand_DagRun(t *testing.T) {
891891 args args
892892 wantErr bool
893893 }{
894- {"t_wrong_number" , args {[]string {"notnumber" }, nil , NewDag ().TensorSet ("tensor1" , TypeFloat32 , []int {1 , 2 }, []int {5 , 10 })}, true },
895- {"t_load" , args {[]string {"persisted_tensor_1" }, []string {"tensor1" }, NewDag ().TensorSet ("tensor1" , TypeFloat32 , []int {1 , 2 }, []int {5 , 10 })}, false },
896- {"t_load_err" , args {[]string {"not_exits_tensor" }, []string {"tensor1" }, NewDag ().TensorSet ("tensor1" , TypeFloat32 , []int {1 , 2 }, []int {5 , 10 })}, true },
897- {"t1" , args {nil , nil , NewDag ().TensorSet ("a" , TypeFloat32 , []int {1 }, []float32 {1.1 })}, false },
898- {"t_blob" , args {nil , nil , NewDag ().TensorSet ("a" , TypeFloat32 , []int {1 }, []float32 {1.1 }).TensorSet ("b" , TypeFloat32 , []int {1 }, []float32 {4.4 }).ModelRun ("test:DagRun:mymodel:1" , []string {"a" , "b" }, []string {"mul" }).TensorGet ("mul" , TensorContentTypeBlob )}, false },
899- {"t_values" , args {nil , nil , NewDag ().TensorSet ("mytensor" , TypeFloat32 , []int {1 , 2 }, []int {5 , 10 }).TensorGet ("mytensor" , TensorContentTypeValues )}, false },
894+ {"t_wrong_number" , args {[]string {"notnumber" }, nil , NewDag ().TensorSet ("tensor1" , TypeFloat32 , []int64 {1 , 2 }, []int64 {5 , 10 })}, true },
895+ {"t_load" , args {[]string {"persisted_tensor_1" }, []string {"tensor1" }, NewDag ().TensorSet ("tensor1" , TypeFloat32 , []int64 {1 , 2 }, []int64 {5 , 10 })}, false },
896+ {"t_load_err" , args {[]string {"not_exits_tensor" }, []string {"tensor1" }, NewDag ().TensorSet ("tensor1" , TypeFloat32 , []int64 {1 , 2 }, []int64 {5 , 10 })}, true },
897+ {"t1" , args {nil , nil , NewDag ().TensorSet ("a" , TypeFloat32 , []int64 {1 }, []float32 {1.1 })}, false },
898+ {"t_blob" , args {nil , nil , NewDag ().TensorSet ("a" , TypeFloat32 , []int64 {1 }, []float32 {1.1 }).TensorSet ("b" , TypeFloat32 , []int64 {1 }, []float32 {4.4 }).ModelRun ("test:DagRun:mymodel:1" , []string {"a" , "b" }, []string {"mul" }).TensorGet ("mul" , TensorContentTypeBlob )}, false },
899+ {"t_values" , args {nil , nil , NewDag ().TensorSet ("mytensor" , TypeFloat32 , []int64 {1 , 2 }, []int64 {5 , 10 }).TensorGet ("mytensor" , TensorContentTypeValues )}, false },
900900 }
901901 for _ , tt := range tests {
902902 t .Run (tt .name , func (t * testing.T ) {
@@ -932,7 +932,7 @@ func TestCommand_DagRun(t *testing.T) {
932932
933933func TestCommand_DagRunRO (t * testing.T ) {
934934 c := createTestClient ()
935- err := c .TensorSet ("persisted_tensor" , TypeFloat32 , []int {1 , 2 }, []float32 {5 , 10 })
935+ err := c .TensorSet ("persisted_tensor" , TypeFloat32 , []int64 {1 , 2 }, []float32 {5 , 10 })
936936 assert .Nil (t , err )
937937 type args struct {
938938 loadKeys []string
@@ -944,8 +944,8 @@ func TestCommand_DagRunRO(t *testing.T) {
944944 wantErr bool
945945 }{
946946 {"t_1" , args {[]string {"persisted_tensor" }, NewDag ().TensorGet ("persisted_tensor" , TensorContentTypeValues )}, false },
947- {"t_2" , args {nil , NewDag ().TensorSet ("tensor1" , TypeFloat32 , []int {1 , 2 }, []int {5 , 10 }).TensorSet ("tensor2" , TypeFloat32 , []int {1 , 2 }, []int {5 , 10 })}, false },
948- {"t_err1" , args {[]string {"notnumber" }, NewDag ().TensorSet ("tensor1" , TypeFloat32 , []int {1 , 2 }, []int {5 , 10 })}, true },
947+ {"t_2" , args {nil , NewDag ().TensorSet ("tensor1" , TypeFloat32 , []int64 {1 , 2 }, []int64 {5 , 10 }).TensorSet ("tensor2" , TypeFloat32 , []int64 {1 , 2 }, []int64 {5 , 10 })}, false },
948+ {"t_err1" , args {[]string {"notnumber" }, NewDag ().TensorSet ("tensor1" , TypeFloat32 , []int64 {1 , 2 }, []int64 {5 , 10 })}, true },
949949 }
950950 for _ , tt := range tests {
951951 t .Run (tt .name , func (t * testing.T ) {
@@ -978,3 +978,40 @@ func TestCommand_DagRunRO(t *testing.T) {
978978 })
979979 }
980980}
981+
982+ func TestClient_ModelRun (t * testing.T ) {
983+ type fields struct {
984+ Pool * redis.Pool
985+ PipelineActive bool
986+ PipelineAutoFlushSize uint32
987+ PipelinePos uint32
988+ ActiveConn redis.Conn
989+ }
990+ type args struct {
991+ name string
992+ inputTensorNames []string
993+ outputTensorNames []string
994+ }
995+ tests := []struct {
996+ name string
997+ fields fields
998+ args args
999+ wantErr bool
1000+ }{
1001+ // TODO: Add test cases.
1002+ }
1003+ for _ , tt := range tests {
1004+ t .Run (tt .name , func (t * testing.T ) {
1005+ c := & Client {
1006+ Pool : tt .fields .Pool ,
1007+ PipelineActive : tt .fields .PipelineActive ,
1008+ PipelineAutoFlushSize : tt .fields .PipelineAutoFlushSize ,
1009+ PipelinePos : tt .fields .PipelinePos ,
1010+ ActiveConn : tt .fields .ActiveConn ,
1011+ }
1012+ if err := c .ModelRun (tt .args .name , tt .args .inputTensorNames , tt .args .outputTensorNames ); (err != nil ) != tt .wantErr {
1013+ t .Errorf ("ModelRun() error = %v, wantErr %v" , err , tt .wantErr )
1014+ }
1015+ })
1016+ }
1017+ }
0 commit comments