MCPcopy Index your code
hub / github.com/cortexlabs/cortex / InterfaceToFloat32Slice

Function InterfaceToFloat32Slice

pkg/lib/cast/interface.go:518–541  ·  view source on GitHub ↗
(in interface{})

Source from the content-addressed store, hash-verified

516}
517
518func InterfaceToFloat32Slice(in interface{}) ([]float32, bool) {
519 if in == nil {
520 return nil, true
521 }
522
523 if floatSlice, ok := in.([]float32); ok {
524 return floatSlice, true
525 }
526
527 inSlice, ok := InterfaceToInterfaceSlice(in)
528 if !ok {
529 return nil, false
530 }
531 out := make([]float32, len(inSlice))
532
533 for i, elem := range inSlice {
534 casted, ok := InterfaceToFloat32(elem)
535 if !ok {
536 return nil, false
537 }
538 out[i] = casted
539 }
540 return out, true
541}
542
543func InterfaceToFloat64Slice(in interface{}) ([]float64, bool) {
544 if in == nil {

Callers 1

Float32ListFunction · 0.92

Calls 2

InterfaceToFloat32Function · 0.85

Tested by

no test coverage detected