You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: utils.go
    path of file: ./repos/gorgonia
    
    the code of the file until where you have to start completion: package gorgonia

import (
	"fmt"
	"hash/fnv"
	"math"
	"sync"

	"github.com/chewxy/math32"
	"github.com/pkg/errors
    
func hasInf(v Value, dev Device) bool {
	switch vt := v.(type) {
	case *F64:
		return math.IsInf(float64(*vt), 0)
	case *F32:
		return math32.IsInf(float32(*vt), 0)
	case tensor.Tensor:
		if e, ok := vt.Engine().(tensor.InfChecker); ok {
			ok, _ := e.HasInf(vt) // BUG: errors not checked
			return ok
		}

		dt := vt.Dtype()
		if dt != tensor.Float64 && dt != tensor.Float32 {
			return false
		}
		switch dt {
		case tensor.Float32:
			data := vt.Data().([]float32)
			for _, datum := range data {
				if math32.IsInf(datum, 0) {
					return true
				}
			}
		case tensor.Float64:
			data := vt.Data().([]float64)
			for _, datum := range data {
				if math.IsInf(datum, 0) {
					return true
				}
			}
		}
		return false
	case *dualValue:
		return hasInf(vt.Value, dev) || hasInf(vt.d, dev)
	default:
		err := nyi("hasInf", v)
		panic(err)
	}
}