fixed tensor.ValueGo() return []int
This commit is contained in:
parent
961080760f
commit
8d586824c2
|
@ -43,7 +43,12 @@ func (ts *Tensor) ValueGo() interface{} {
|
|||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
// fmt.Println(dst)
|
||||
|
||||
// convert []int32 -> int
|
||||
if reflect.TypeOf(dst).String() == "[]int32" {
|
||||
dst = sliceInt32ToInt(dst.([]int32))
|
||||
}
|
||||
|
||||
return dst
|
||||
}
|
||||
func (ts *Tensor) ToSlice() reflect.Value {
|
||||
|
|
|
@ -490,3 +490,11 @@ func sliceIntToInt32(input []int) []int32 {
|
|||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func sliceInt32ToInt(input []int32) []int {
|
||||
out := make([]int, len(input))
|
||||
for i := 0; i < len(input); i++ {
|
||||
out[i] = int(input[i])
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user