util

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FileSystem = afs.New()

Functions

func ArgMax

func ArgMax(s []float32) (int, float32, error)

ArgMax find both index of max value in s and max value

func CloseFile

func CloseFile(file io.Closer) error

func GetPathType

func GetPathType(path string) string

func Mean

func Mean(vector []float32) float32

Mean of a float32 vector

func PathJoinSafe

func PathJoinSafe(elem ...string) string

PathJoinSafe wrapper around filepath.Join to ensure that paths are correctly constructed if the path is a normal OS path, just use filepath.Join if the path is S3, trim any trailing slashes and construct it manually from the components so that double slashes (e.g. s3://) are preserved.

func ReadFileBytes

func ReadFileBytes(filename string) ([]byte, error)

func SoftMax

func SoftMax(vector []float32) []float32

SoftMax take a vector and calculate softmax scores of its values

func SumSlice

func SumSlice(s []float64) float64

Types

type AfsFS

type AfsFS struct {
}

func (AfsFS) Open

func (afs AfsFS) Open(name string) (fs.File, error)

type AfsFile

type AfsFile struct {
	// contains filtered or unexported fields
}

func (*AfsFile) Close

func (file *AfsFile) Close() error

func (*AfsFile) Read

func (file *AfsFile) Read(p []byte) (int, error)

func (*AfsFile) Stat

func (file *AfsFile) Stat() (fs.FileInfo, error)

type AfsFileInfo

type AfsFileInfo struct {
	// contains filtered or unexported fields
}

func (AfsFileInfo) IsDir

func (fileInfo AfsFileInfo) IsDir() bool

func (AfsFileInfo) ModTime

func (fileInfo AfsFileInfo) ModTime() time.Time

func (AfsFileInfo) Mode

func (fileInfo AfsFileInfo) Mode() fs.FileMode

func (AfsFileInfo) Name

func (fileInfo AfsFileInfo) Name() string

func (AfsFileInfo) Size

func (fileInfo AfsFileInfo) Size() int64

func (AfsFileInfo) Sys

func (fileInfo AfsFileInfo) Sys() any

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL