runner: simplify tensor split parsing
This commit is contained in:
parent
a59f665235
commit
d6af13efed
@ -943,12 +943,11 @@ func Execute(args []string) error {
|
|||||||
|
|
||||||
var tensorSplitFloats []float32
|
var tensorSplitFloats []float32
|
||||||
if *tensorSplit != "" {
|
if *tensorSplit != "" {
|
||||||
stringFloats := regexp.MustCompile(",").Split(*tensorSplit, -1)
|
splits := strings.Split(*tensorSplit, ",")
|
||||||
|
tensorSplitFloats = make([]float32, len(splits))
|
||||||
tensorSplitFloats = make([]float32, 0, len(stringFloats))
|
for i, s := range splits {
|
||||||
for _, s := range stringFloats {
|
|
||||||
f, _ := strconv.ParseFloat(s, 32)
|
f, _ := strconv.ParseFloat(s, 32)
|
||||||
tensorSplitFloats = append(tensorSplitFloats, float32(f))
|
tensorSplitFloats[i] = float32(f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -881,12 +881,11 @@ func Execute(args []string) error {
|
|||||||
|
|
||||||
var tensorSplitFloats []float32
|
var tensorSplitFloats []float32
|
||||||
if *tensorSplit != "" {
|
if *tensorSplit != "" {
|
||||||
stringFloats := regexp.MustCompile(",").Split(*tensorSplit, -1)
|
splits := strings.Split(*tensorSplit, ",")
|
||||||
|
tensorSplitFloats = make([]float32, len(splits))
|
||||||
tensorSplitFloats = make([]float32, 0, len(stringFloats))
|
for i, s := range splits {
|
||||||
for _, s := range stringFloats {
|
|
||||||
f, _ := strconv.ParseFloat(s, 32)
|
f, _ := strconv.ParseFloat(s, 32)
|
||||||
tensorSplitFloats = append(tensorSplitFloats, float32(f))
|
tensorSplitFloats[i] = float32(f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user