id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
127,500
gorgonia/cu
dnn/generated_ctcloss.go
NewCTCLoss
func NewCTCLoss(compType DataType) (retVal *CTCLoss, err error) { var internal C.cudnnCTCLossDescriptor_t if err := result(C.cudnnCreateCTCLossDescriptor(&internal)); err != nil { return nil, err } if err := result(C.cudnnSetCTCLossDescriptor(internal, compType.C())); err != nil { return nil, err } retVal =...
go
func NewCTCLoss(compType DataType) (retVal *CTCLoss, err error) { var internal C.cudnnCTCLossDescriptor_t if err := result(C.cudnnCreateCTCLossDescriptor(&internal)); err != nil { return nil, err } if err := result(C.cudnnSetCTCLossDescriptor(internal, compType.C())); err != nil { return nil, err } retVal =...
[ "func", "NewCTCLoss", "(", "compType", "DataType", ")", "(", "retVal", "*", "CTCLoss", ",", "err", "error", ")", "{", "var", "internal", "C", ".", "cudnnCTCLossDescriptor_t", "\n", "if", "err", ":=", "result", "(", "C", ".", "cudnnCreateCTCLossDescriptor", "...
// NewCTCLoss creates a new CTCLoss.
[ "NewCTCLoss", "creates", "a", "new", "CTCLoss", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/dnn/generated_ctcloss.go#L17-L33
127,501
gorgonia/cu
ctx_debug.go
NewContext
func NewContext(d Device, flags ContextFlags) *Ctx { var cctx C.CUcontext err := result(C.cuCtxCreate(&cctx, C.uint(flags), C.CUdevice(d))) if err != nil { panic(err) } ctx := newContext(makeContext(cctx)) ctx.device = d ctx.flags = flags errChan := make(chan error) go ctx.Run(errChan) if err := <-errChan;...
go
func NewContext(d Device, flags ContextFlags) *Ctx { var cctx C.CUcontext err := result(C.cuCtxCreate(&cctx, C.uint(flags), C.CUdevice(d))) if err != nil { panic(err) } ctx := newContext(makeContext(cctx)) ctx.device = d ctx.flags = flags errChan := make(chan error) go ctx.Run(errChan) if err := <-errChan;...
[ "func", "NewContext", "(", "d", "Device", ",", "flags", "ContextFlags", ")", "*", "Ctx", "{", "var", "cctx", "C", ".", "CUcontext", "\n", "err", ":=", "result", "(", "C", ".", "cuCtxCreate", "(", "&", "cctx", ",", "C", ".", "uint", "(", "flags", ")...
// NewContext creates a new context, and runs a listener locked to an OSThread. All work is piped through that goroutine
[ "NewContext", "creates", "a", "new", "context", "and", "runs", "a", "listener", "locked", "to", "an", "OSThread", ".", "All", "work", "is", "piped", "through", "that", "goroutine" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/ctx_debug.go#L25-L42
127,502
gorgonia/cu
module.go
LoadData
func LoadData(image string) (Module, error) { var mod Module cstr := C.CString(image) defer C.free(unsafe.Pointer(cstr)) err := result(C.cuModuleLoadData(&mod.mod, unsafe.Pointer(cstr))) return mod, err }
go
func LoadData(image string) (Module, error) { var mod Module cstr := C.CString(image) defer C.free(unsafe.Pointer(cstr)) err := result(C.cuModuleLoadData(&mod.mod, unsafe.Pointer(cstr))) return mod, err }
[ "func", "LoadData", "(", "image", "string", ")", "(", "Module", ",", "error", ")", "{", "var", "mod", "Module", "\n", "cstr", ":=", "C", ".", "CString", "(", "image", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr",...
// LoadData loads a module from a input string.
[ "LoadData", "loads", "a", "module", "from", "a", "input", "string", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/module.go#L32-L38
127,503
gorgonia/cu
module.go
LoadDataEx
func LoadDataEx(image string, options ...JITOption) (Module, error) { var mod Module cstr := C.CString(image) defer C.free(unsafe.Pointer(cstr)) argcount, args, argvals := encodeArguments(options) err := result(C.cuModuleLoadDataEx(&mod.mod, unsafe.Pointer(cstr), argcount, args, argvals)) return mod, err }
go
func LoadDataEx(image string, options ...JITOption) (Module, error) { var mod Module cstr := C.CString(image) defer C.free(unsafe.Pointer(cstr)) argcount, args, argvals := encodeArguments(options) err := result(C.cuModuleLoadDataEx(&mod.mod, unsafe.Pointer(cstr), argcount, args, argvals)) return mod, err }
[ "func", "LoadDataEx", "(", "image", "string", ",", "options", "...", "JITOption", ")", "(", "Module", ",", "error", ")", "{", "var", "mod", "Module", "\n", "cstr", ":=", "C", ".", "CString", "(", "image", ")", "\n", "defer", "C", ".", "free", "(", ...
// LoadDataEx loads a module from a input string.
[ "LoadDataEx", "loads", "a", "module", "from", "a", "input", "string", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/module.go#L41-L49
127,504
gorgonia/cu
module.go
LoadFatBinary
func LoadFatBinary(image string) (Module, error) { var mod Module cstr := C.CString(image) defer C.free(unsafe.Pointer(cstr)) err := result(C.cuModuleLoadFatBinary(&mod.mod, unsafe.Pointer(cstr))) return mod, err }
go
func LoadFatBinary(image string) (Module, error) { var mod Module cstr := C.CString(image) defer C.free(unsafe.Pointer(cstr)) err := result(C.cuModuleLoadFatBinary(&mod.mod, unsafe.Pointer(cstr))) return mod, err }
[ "func", "LoadFatBinary", "(", "image", "string", ")", "(", "Module", ",", "error", ")", "{", "var", "mod", "Module", "\n", "cstr", ":=", "C", ".", "CString", "(", "image", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "c...
// LoadFatBinary loads a module from a input string.
[ "LoadFatBinary", "loads", "a", "module", "from", "a", "input", "string", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/module.go#L52-L58
127,505
gorgonia/cu
module.go
Function
func (m Module) Function(name string) (Function, error) { var fn Function cstr := C.CString(name) defer C.free(unsafe.Pointer(cstr)) err := result(C.cuModuleGetFunction(&fn.fn, m.mod, cstr)) return fn, err }
go
func (m Module) Function(name string) (Function, error) { var fn Function cstr := C.CString(name) defer C.free(unsafe.Pointer(cstr)) err := result(C.cuModuleGetFunction(&fn.fn, m.mod, cstr)) return fn, err }
[ "func", "(", "m", "Module", ")", "Function", "(", "name", "string", ")", "(", "Function", ",", "error", ")", "{", "var", "fn", "Function", "\n", "cstr", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ...
// Function returns a pointer to the function in the module by the name. If it's not found, the error NotFound is returned
[ "Function", "returns", "a", "pointer", "to", "the", "function", "in", "the", "module", "by", "the", "name", ".", "If", "it", "s", "not", "found", "the", "error", "NotFound", "is", "returned" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/module.go#L61-L67
127,506
gorgonia/cu
module.go
Global
func (m Module) Global(name string) (DevicePtr, int64, error) { var d C.CUdeviceptr var size C.size_t cstr := C.CString(name) defer C.free(unsafe.Pointer(cstr)) if err := result(C.cuModuleGetGlobal(&d, &size, m.mod, cstr)); err != nil { return 0, 0, err } return DevicePtr(d), int64(size), nil }
go
func (m Module) Global(name string) (DevicePtr, int64, error) { var d C.CUdeviceptr var size C.size_t cstr := C.CString(name) defer C.free(unsafe.Pointer(cstr)) if err := result(C.cuModuleGetGlobal(&d, &size, m.mod, cstr)); err != nil { return 0, 0, err } return DevicePtr(d), int64(size), nil }
[ "func", "(", "m", "Module", ")", "Global", "(", "name", "string", ")", "(", "DevicePtr", ",", "int64", ",", "error", ")", "{", "var", "d", "C", ".", "CUdeviceptr", "\n", "var", "size", "C", ".", "size_t", "\n", "cstr", ":=", "C", ".", "CString", ...
// Global returns a global pointer as defined in a module. It returns a pointer to the memory in the device.
[ "Global", "returns", "a", "global", "pointer", "as", "defined", "in", "a", "module", ".", "It", "returns", "a", "pointer", "to", "the", "memory", "in", "the", "device", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/module.go#L70-L79
127,507
gorgonia/cu
jit.go
NewLink
func NewLink(options ...JITOption) (*LinkState, error) { link := &LinkState{} argcount, args, argvals := link.encodeArguments(options) err := result(C.cuLinkCreate(argcount, args, argvals, &link.state)) return link, err }
go
func NewLink(options ...JITOption) (*LinkState, error) { link := &LinkState{} argcount, args, argvals := link.encodeArguments(options) err := result(C.cuLinkCreate(argcount, args, argvals, &link.state)) return link, err }
[ "func", "NewLink", "(", "options", "...", "JITOption", ")", "(", "*", "LinkState", ",", "error", ")", "{", "link", ":=", "&", "LinkState", "{", "}", "\n\n", "argcount", ",", "args", ",", "argvals", ":=", "link", ".", "encodeArguments", "(", "options", ...
// Creates a pending JIT linker invocation.
[ "Creates", "a", "pending", "JIT", "linker", "invocation", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/jit.go#L190-L196
127,508
gorgonia/cu
jit.go
AddData
func (link *LinkState) AddData(input JITInputType, data string, name string, options ...JITOption) error { argcount, args, argvals := link.encodeArguments(options) cname := C.CString(name) bytes := []byte(data) err := result(C.cuLinkAddData( link.state, C.CUjitInputType(input), unsafe.Pointer(&bytes[0]), C.siz...
go
func (link *LinkState) AddData(input JITInputType, data string, name string, options ...JITOption) error { argcount, args, argvals := link.encodeArguments(options) cname := C.CString(name) bytes := []byte(data) err := result(C.cuLinkAddData( link.state, C.CUjitInputType(input), unsafe.Pointer(&bytes[0]), C.siz...
[ "func", "(", "link", "*", "LinkState", ")", "AddData", "(", "input", "JITInputType", ",", "data", "string", ",", "name", "string", ",", "options", "...", "JITOption", ")", "error", "{", "argcount", ",", "args", ",", "argvals", ":=", "link", ".", "encodeA...
// Add an input to a pending linker invocation
[ "Add", "an", "input", "to", "a", "pending", "linker", "invocation" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/jit.go#L223-L236
127,509
gorgonia/cu
jit.go
AddFile
func (link *LinkState) AddFile(input JITInputType, path string, options ...JITOption) error { argcount, args, argvals := link.encodeArguments(options) cpath := C.CString(path) err := result(C.cuLinkAddFile( link.state, C.CUjitInputType(input), cpath, argcount, args, argvals, )) C.free(unsafe.Pointer(cpath))...
go
func (link *LinkState) AddFile(input JITInputType, path string, options ...JITOption) error { argcount, args, argvals := link.encodeArguments(options) cpath := C.CString(path) err := result(C.cuLinkAddFile( link.state, C.CUjitInputType(input), cpath, argcount, args, argvals, )) C.free(unsafe.Pointer(cpath))...
[ "func", "(", "link", "*", "LinkState", ")", "AddFile", "(", "input", "JITInputType", ",", "path", "string", ",", "options", "...", "JITOption", ")", "error", "{", "argcount", ",", "args", ",", "argvals", ":=", "link", ".", "encodeArguments", "(", "options"...
// Add a file input to a pending linker invocation
[ "Add", "a", "file", "input", "to", "a", "pending", "linker", "invocation" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/jit.go#L239-L250
127,510
gorgonia/cu
jit.go
Complete
func (link *LinkState) Complete() (string, error) { var data unsafe.Pointer var datasize C.size_t err := result(C.cuLinkComplete(link.state, &data, &datasize)) if err != nil { return "", err } size := int(datasize) buffer := make([]byte, size) copy(buffer, (*[20 << 30]byte)(data)[:size]) return string(buf...
go
func (link *LinkState) Complete() (string, error) { var data unsafe.Pointer var datasize C.size_t err := result(C.cuLinkComplete(link.state, &data, &datasize)) if err != nil { return "", err } size := int(datasize) buffer := make([]byte, size) copy(buffer, (*[20 << 30]byte)(data)[:size]) return string(buf...
[ "func", "(", "link", "*", "LinkState", ")", "Complete", "(", ")", "(", "string", ",", "error", ")", "{", "var", "data", "unsafe", ".", "Pointer", "\n", "var", "datasize", "C", ".", "size_t", "\n\n", "err", ":=", "result", "(", "C", ".", "cuLinkComple...
// Complete a pending linker invocation
[ "Complete", "a", "pending", "linker", "invocation" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/jit.go#L253-L267
127,511
gorgonia/cu
cmd/gencudnn/parse.go
functions
func functions(decl *cc.Declarator) bool { if !strings.HasPrefix(bindgen.NameOf(decl), "cudnn") { return false } if decl.Type.Kind() == cc.Function { return true } return false }
go
func functions(decl *cc.Declarator) bool { if !strings.HasPrefix(bindgen.NameOf(decl), "cudnn") { return false } if decl.Type.Kind() == cc.Function { return true } return false }
[ "func", "functions", "(", "decl", "*", "cc", ".", "Declarator", ")", "bool", "{", "if", "!", "strings", ".", "HasPrefix", "(", "bindgen", ".", "NameOf", "(", "decl", ")", ",", "\"", "\"", ")", "{", "return", "false", "\n", "}", "\n", "if", "decl", ...
// Functions returns the C function declarations in the givel set of file paths.
[ "Functions", "returns", "the", "C", "function", "declarations", "in", "the", "givel", "set", "of", "file", "paths", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/cmd/gencudnn/parse.go#L12-L21
127,512
gorgonia/cu
cmd/gencudnn/parse.go
goNameOfStr
func goNameOfStr(n string) (retVal string) { var ok bool defer func() { retVal = reqPtr(retVal) }() if retVal, ok = ctypes2GoTypes[n]; ok { return retVal } if retVal, ok = enumMappings[n]; ok { return retVal } if retVal, ok = builtins[n]; ok { return retVal } if retVal, ok = nonPrimitives[n]; ok { r...
go
func goNameOfStr(n string) (retVal string) { var ok bool defer func() { retVal = reqPtr(retVal) }() if retVal, ok = ctypes2GoTypes[n]; ok { return retVal } if retVal, ok = enumMappings[n]; ok { return retVal } if retVal, ok = builtins[n]; ok { return retVal } if retVal, ok = nonPrimitives[n]; ok { r...
[ "func", "goNameOfStr", "(", "n", "string", ")", "(", "retVal", "string", ")", "{", "var", "ok", "bool", "\n", "defer", "func", "(", ")", "{", "retVal", "=", "reqPtr", "(", "retVal", ")", "\n", "}", "(", ")", "\n", "if", "retVal", ",", "ok", "=", ...
// same as above, but given a c name type in string
[ "same", "as", "above", "but", "given", "a", "c", "name", "type", "in", "string" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/cmd/gencudnn/parse.go#L190-L209
127,513
gorgonia/cu
dnn/rnn.go
NewRNN
func (handle *Context) NewRNN(hiddenSize int, numLayers int, dropout *Dropout, inputMode RNNInputMode, direction DirectionMode, mode RNNMode, algo RNNAlgo, dataType DataType) (retVal *RNN, err error) { var internal C.cudnnRNNDescriptor_t if err := result(C.cudnnCreateRNNDescriptor(&internal)); err != nil { return n...
go
func (handle *Context) NewRNN(hiddenSize int, numLayers int, dropout *Dropout, inputMode RNNInputMode, direction DirectionMode, mode RNNMode, algo RNNAlgo, dataType DataType) (retVal *RNN, err error) { var internal C.cudnnRNNDescriptor_t if err := result(C.cudnnCreateRNNDescriptor(&internal)); err != nil { return n...
[ "func", "(", "handle", "*", "Context", ")", "NewRNN", "(", "hiddenSize", "int", ",", "numLayers", "int", ",", "dropout", "*", "Dropout", ",", "inputMode", "RNNInputMode", ",", "direction", "DirectionMode", ",", "mode", "RNNMode", ",", "algo", "RNNAlgo", ",",...
// NewRNN creates a new RNN.
[ "NewRNN", "creates", "a", "new", "RNN", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/dnn/rnn.go#L61-L86
127,514
gorgonia/cu
dnn/dropout.go
NewDropout
func NewDropout(dropout float64) (retVal *Dropout, err error) { var internal C.cudnnDropoutDescriptor_t if err := result(C.cudnnCreateDropoutDescriptor(&internal)); err != nil { return nil, err } retVal = &Dropout{ internal: internal, dropout: float32(dropout), } runtime.SetFinalizer(retVal, destroyDropout...
go
func NewDropout(dropout float64) (retVal *Dropout, err error) { var internal C.cudnnDropoutDescriptor_t if err := result(C.cudnnCreateDropoutDescriptor(&internal)); err != nil { return nil, err } retVal = &Dropout{ internal: internal, dropout: float32(dropout), } runtime.SetFinalizer(retVal, destroyDropout...
[ "func", "NewDropout", "(", "dropout", "float64", ")", "(", "retVal", "*", "Dropout", ",", "err", "error", ")", "{", "var", "internal", "C", ".", "cudnnDropoutDescriptor_t", "\n", "if", "err", ":=", "result", "(", "C", ".", "cudnnCreateDropoutDescriptor", "("...
// NewDropout creates a Dropout descriptor. It is not usable by default because some additional stateful information needs to be passed in
[ "NewDropout", "creates", "a", "Dropout", "descriptor", ".", "It", "is", "not", "usable", "by", "default", "because", "some", "additional", "stateful", "information", "needs", "to", "be", "passed", "in" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/dnn/dropout.go#L35-L46
127,515
gorgonia/cu
dnn/dropout.go
Use
func (d *Dropout) Use(ctx *Context, states Memory, stateSizeInBytes uintptr, seed uint64) error { d.handle = ctx d.states = states d.stateSizeInBytes = stateSizeInBytes d.seed = seed return result(C.cudnnSetDropoutDescriptor(d.internal, d.handle.internal, C.float(d.dropout), unsafe.Pointer(d.states.Uintptr()), C....
go
func (d *Dropout) Use(ctx *Context, states Memory, stateSizeInBytes uintptr, seed uint64) error { d.handle = ctx d.states = states d.stateSizeInBytes = stateSizeInBytes d.seed = seed return result(C.cudnnSetDropoutDescriptor(d.internal, d.handle.internal, C.float(d.dropout), unsafe.Pointer(d.states.Uintptr()), C....
[ "func", "(", "d", "*", "Dropout", ")", "Use", "(", "ctx", "*", "Context", ",", "states", "Memory", ",", "stateSizeInBytes", "uintptr", ",", "seed", "uint64", ")", "error", "{", "d", ".", "handle", "=", "ctx", "\n", "d", ".", "states", "=", "states", ...
// Use is the second stage of the two-stage API.
[ "Use", "is", "the", "second", "stage", "of", "the", "two", "-", "stage", "API", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/dnn/dropout.go#L58-L65
127,516
gorgonia/cu
dnn/dropout.go
IsReady
func (d *Dropout) IsReady() bool { return d.handle != nil && d.states != nil && d.stateSizeInBytes != 0 }
go
func (d *Dropout) IsReady() bool { return d.handle != nil && d.states != nil && d.stateSizeInBytes != 0 }
[ "func", "(", "d", "*", "Dropout", ")", "IsReady", "(", ")", "bool", "{", "return", "d", ".", "handle", "!=", "nil", "&&", "d", ".", "states", "!=", "nil", "&&", "d", ".", "stateSizeInBytes", "!=", "0", "\n", "}" ]
// IsReady indicates if the dropout operator is ready to be used
[ "IsReady", "indicates", "if", "the", "dropout", "operator", "is", "ready", "to", "be", "used" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/dnn/dropout.go#L68-L70
127,517
gorgonia/cu
dnn/dropout.go
Reset
func (d *Dropout) Reset() { d.handle = nil d.states = nil d.stateSizeInBytes = 0 d.seed = 0 }
go
func (d *Dropout) Reset() { d.handle = nil d.states = nil d.stateSizeInBytes = 0 d.seed = 0 }
[ "func", "(", "d", "*", "Dropout", ")", "Reset", "(", ")", "{", "d", ".", "handle", "=", "nil", "\n", "d", ".", "states", "=", "nil", "\n", "d", ".", "stateSizeInBytes", "=", "0", "\n", "d", ".", "seed", "=", "0", "\n", "}" ]
// Reset resets the state to be not ready. It does NOT reset the dropout ratio.
[ "Reset", "resets", "the", "state", "to", "be", "not", "ready", ".", "It", "does", "NOT", "reset", "the", "dropout", "ratio", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/dnn/dropout.go#L73-L78
127,518
gorgonia/cu
occupancy.go
MaxActiveBlocksPerMultiProcessor
func (fn Function) MaxActiveBlocksPerMultiProcessor(blockSize int, dynamicSmemSize int64) (int, error) { bs := C.int(blockSize) dss := C.size_t(dynamicSmemSize) var numBlocks C.int if err := result(C.cuOccupancyMaxActiveBlocksPerMultiprocessor(&numBlocks, fn.fn, bs, dss)); err != nil { return 0, err } return i...
go
func (fn Function) MaxActiveBlocksPerMultiProcessor(blockSize int, dynamicSmemSize int64) (int, error) { bs := C.int(blockSize) dss := C.size_t(dynamicSmemSize) var numBlocks C.int if err := result(C.cuOccupancyMaxActiveBlocksPerMultiprocessor(&numBlocks, fn.fn, bs, dss)); err != nil { return 0, err } return i...
[ "func", "(", "fn", "Function", ")", "MaxActiveBlocksPerMultiProcessor", "(", "blockSize", "int", ",", "dynamicSmemSize", "int64", ")", "(", "int", ",", "error", ")", "{", "bs", ":=", "C", ".", "int", "(", "blockSize", ")", "\n", "dss", ":=", "C", ".", ...
// MaxActiveBlocksPerMultiProcessor returns the number of the maximum active blocks per streaming multiprocessor.
[ "MaxActiveBlocksPerMultiProcessor", "returns", "the", "number", "of", "the", "maximum", "active", "blocks", "per", "streaming", "multiprocessor", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/occupancy.go#L7-L16
127,519
gorgonia/cu
occupancy.go
MaxActiveBlocksPerMultiProcessorWithFlags
func (fn Function) MaxActiveBlocksPerMultiProcessorWithFlags(blockSize int, dynamicSmemSize int64, flags OccupancyFlags) (int, error) { bs := C.int(blockSize) dss := C.size_t(dynamicSmemSize) of := C.uint(flags) var numBlocks C.int if err := result(C.cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(&numBlocks...
go
func (fn Function) MaxActiveBlocksPerMultiProcessorWithFlags(blockSize int, dynamicSmemSize int64, flags OccupancyFlags) (int, error) { bs := C.int(blockSize) dss := C.size_t(dynamicSmemSize) of := C.uint(flags) var numBlocks C.int if err := result(C.cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags(&numBlocks...
[ "func", "(", "fn", "Function", ")", "MaxActiveBlocksPerMultiProcessorWithFlags", "(", "blockSize", "int", ",", "dynamicSmemSize", "int64", ",", "flags", "OccupancyFlags", ")", "(", "int", ",", "error", ")", "{", "bs", ":=", "C", ".", "int", "(", "blockSize", ...
// MaxActiveBlocksPerMultiProcessorWithFlags returns the number of the maximum active blocks per streaming multiprocessor. // The flags control how special cases are handled.
[ "MaxActiveBlocksPerMultiProcessorWithFlags", "returns", "the", "number", "of", "the", "maximum", "active", "blocks", "per", "streaming", "multiprocessor", ".", "The", "flags", "control", "how", "special", "cases", "are", "handled", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/occupancy.go#L20-L30
127,520
gorgonia/cu
cmd/gencudnn/parsego.go
checkNils
func (s *PkgState) checkNils() []string { var retVal []string for _, f := range s.Files { for _, decl := range f.Decls { fn, ok := decl.(*ast.FuncDecl) if !ok { continue } if fn.Type.Results == nil { continue } retVals := make(map[string]bool) // name:isPtr retTypes := make(map[strin...
go
func (s *PkgState) checkNils() []string { var retVal []string for _, f := range s.Files { for _, decl := range f.Decls { fn, ok := decl.(*ast.FuncDecl) if !ok { continue } if fn.Type.Results == nil { continue } retVals := make(map[string]bool) // name:isPtr retTypes := make(map[strin...
[ "func", "(", "s", "*", "PkgState", ")", "checkNils", "(", ")", "[", "]", "string", "{", "var", "retVal", "[", "]", "string", "\n", "for", "_", ",", "f", ":=", "range", "s", ".", "Files", "{", "for", "_", ",", "decl", ":=", "range", "f", ".", ...
// checkNils checks the package for functions that return potentially nil pointer types. // // It expects functions to have return names. Which is what the generator generates anyways
[ "checkNils", "checks", "the", "package", "for", "functions", "that", "return", "potentially", "nil", "pointer", "types", ".", "It", "expects", "functions", "to", "have", "return", "names", ".", "Which", "is", "what", "the", "generator", "generates", "anyways" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/cmd/gencudnn/parsego.go#L37-L100
127,521
gorgonia/cu
cmd/gencudnn/parsego.go
usedCFn
func (pkg *PkgState) usedCFn() map[string]int { retVal := make(map[string]int) visitor := &usedCFnVisit{retVal} for _, f := range pkg.Files { for _, decl := range f.Decls { fn, ok := decl.(*ast.FuncDecl) if !ok { continue } ast.Walk(visitor, fn) } } return retVal }
go
func (pkg *PkgState) usedCFn() map[string]int { retVal := make(map[string]int) visitor := &usedCFnVisit{retVal} for _, f := range pkg.Files { for _, decl := range f.Decls { fn, ok := decl.(*ast.FuncDecl) if !ok { continue } ast.Walk(visitor, fn) } } return retVal }
[ "func", "(", "pkg", "*", "PkgState", ")", "usedCFn", "(", ")", "map", "[", "string", "]", "int", "{", "retVal", ":=", "make", "(", "map", "[", "string", "]", "int", ")", "\n", "visitor", ":=", "&", "usedCFnVisit", "{", "retVal", "}", "\n", "for", ...
// useCFn returns the count of how many times a C function has been used in the generated package
[ "useCFn", "returns", "the", "count", "of", "how", "many", "times", "a", "C", "function", "has", "been", "used", "in", "the", "generated", "package" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/cmd/gencudnn/parsego.go#L118-L131
127,522
gorgonia/cu
dnn/convolution.go
MakeConvolutionPreference
func MakeConvolutionPreference(t ConvolutionType, pref ConvolutionPreference) ConvolutionPreference { return ConvolutionPreference(byte(t) | byte(pref)) }
go
func MakeConvolutionPreference(t ConvolutionType, pref ConvolutionPreference) ConvolutionPreference { return ConvolutionPreference(byte(t) | byte(pref)) }
[ "func", "MakeConvolutionPreference", "(", "t", "ConvolutionType", ",", "pref", "ConvolutionPreference", ")", "ConvolutionPreference", "{", "return", "ConvolutionPreference", "(", "byte", "(", "t", ")", "|", "byte", "(", "pref", ")", ")", "\n", "}" ]
// MakeConvolutionPreference allows the creation of a tagged preference - whether it's fwd, bwd or data or filter
[ "MakeConvolutionPreference", "allows", "the", "creation", "of", "a", "tagged", "preference", "-", "whether", "it", "s", "fwd", "bwd", "or", "data", "or", "filter" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/dnn/convolution.go#L35-L37
127,523
gorgonia/cu
cmd/gencudnn/params.go
isOutputPtrOfPrim
func isOutputPtrOfPrim(fnName string, p bg.Parameter) bool { if !isOutput(fnName, p) && !isIO(fnName, p) { return false } if !p.IsPointer() { return false } return isBuiltin(depointerize(nameOfType(p.Type()))) }
go
func isOutputPtrOfPrim(fnName string, p bg.Parameter) bool { if !isOutput(fnName, p) && !isIO(fnName, p) { return false } if !p.IsPointer() { return false } return isBuiltin(depointerize(nameOfType(p.Type()))) }
[ "func", "isOutputPtrOfPrim", "(", "fnName", "string", ",", "p", "bg", ".", "Parameter", ")", "bool", "{", "if", "!", "isOutput", "(", "fnName", ",", "p", ")", "&&", "!", "isIO", "(", "fnName", ",", "p", ")", "{", "return", "false", "\n", "}", "\n",...
// functions for convertibility
[ "functions", "for", "convertibility" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/cmd/gencudnn/params.go#L31-L39
127,524
gorgonia/cu
cu.go
Version
func Version() int { var v C.int if err := result(C.cuDriverGetVersion(&v)); err != nil { return -1 } return int(v) }
go
func Version() int { var v C.int if err := result(C.cuDriverGetVersion(&v)); err != nil { return -1 } return int(v) }
[ "func", "Version", "(", ")", "int", "{", "var", "v", "C", ".", "int", "\n", "if", "err", ":=", "result", "(", "C", ".", "cuDriverGetVersion", "(", "&", "v", ")", ")", ";", "err", "!=", "nil", "{", "return", "-", "1", "\n", "}", "\n", "return", ...
// Version returns the version of the CUDA driver
[ "Version", "returns", "the", "version", "of", "the", "CUDA", "driver" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/cu.go#L19-L25
127,525
gorgonia/cu
convenience.go
MemoryType
func (mem DevicePtr) MemoryType() (typ MemoryType, err error) { var p unsafe.Pointer if p, err = mem.PtrAttribute(MemoryTypeAttr); err != nil { return } t := *(*uint64)(p) typ = MemoryType(byte(t)) return }
go
func (mem DevicePtr) MemoryType() (typ MemoryType, err error) { var p unsafe.Pointer if p, err = mem.PtrAttribute(MemoryTypeAttr); err != nil { return } t := *(*uint64)(p) typ = MemoryType(byte(t)) return }
[ "func", "(", "mem", "DevicePtr", ")", "MemoryType", "(", ")", "(", "typ", "MemoryType", ",", "err", "error", ")", "{", "var", "p", "unsafe", ".", "Pointer", "\n", "if", "p", ",", "err", "=", "mem", ".", "PtrAttribute", "(", "MemoryTypeAttr", ")", ";"...
// This file lists all the convenience functions and methods, not necessarily stuff that is covered in the API // MemoryType returns the MemoryType of the memory
[ "This", "file", "lists", "all", "the", "convenience", "functions", "and", "methods", "not", "necessarily", "stuff", "that", "is", "covered", "in", "the", "API", "MemoryType", "returns", "the", "MemoryType", "of", "the", "memory" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/convenience.go#L15-L23
127,526
gorgonia/cu
convenience.go
MemSize
func (mem DevicePtr) MemSize() uintptr { size, _, err := mem.AddressRange() if err != nil { log.Printf("MEMSIZE ERR %v", err) } return uintptr(size) }
go
func (mem DevicePtr) MemSize() uintptr { size, _, err := mem.AddressRange() if err != nil { log.Printf("MEMSIZE ERR %v", err) } return uintptr(size) }
[ "func", "(", "mem", "DevicePtr", ")", "MemSize", "(", ")", "uintptr", "{", "size", ",", "_", ",", "err", ":=", "mem", ".", "AddressRange", "(", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\...
// MemSize returns the size of the memory slab in bytes. Returns 0 if errors occured
[ "MemSize", "returns", "the", "size", "of", "the", "memory", "slab", "in", "bytes", ".", "Returns", "0", "if", "errors", "occured" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/convenience.go#L26-L32
127,527
gorgonia/cu
convenience.go
ComputeCapability
func (d Device) ComputeCapability() (major, minor int, err error) { var attrs []int if attrs, err = d.Attributes(ComputeCapabilityMajor, ComputeCapabilityMinor); err != nil { err = errors.Wrapf(err, "Failed to get ComputeCapability") return } major = attrs[0] minor = attrs[1] return }
go
func (d Device) ComputeCapability() (major, minor int, err error) { var attrs []int if attrs, err = d.Attributes(ComputeCapabilityMajor, ComputeCapabilityMinor); err != nil { err = errors.Wrapf(err, "Failed to get ComputeCapability") return } major = attrs[0] minor = attrs[1] return }
[ "func", "(", "d", "Device", ")", "ComputeCapability", "(", ")", "(", "major", ",", "minor", "int", ",", "err", "error", ")", "{", "var", "attrs", "[", "]", "int", "\n", "if", "attrs", ",", "err", "=", "d", ".", "Attributes", "(", "ComputeCapabilityMa...
// ComputeCapability returns the compute capability of the device. // This method is a convenience method for the deprecated API call cuDeviceComputeCapability.
[ "ComputeCapability", "returns", "the", "compute", "capability", "of", "the", "device", ".", "This", "method", "is", "a", "convenience", "method", "for", "the", "deprecated", "API", "call", "cuDeviceComputeCapability", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/convenience.go#L41-L50
127,528
gorgonia/cu
dnn/generated_spatialtransformer.go
NewSpatialTransformer
func NewSpatialTransformer(samplerType SamplerType, dataType DataType, nbDims int, dimA []int) (retVal *SpatialTransformer, err error) { var internal C.cudnnSpatialTransformerDescriptor_t if err := result(C.cudnnCreateSpatialTransformerDescriptor(&internal)); err != nil { return nil, err } dimAC, dimACManaged :=...
go
func NewSpatialTransformer(samplerType SamplerType, dataType DataType, nbDims int, dimA []int) (retVal *SpatialTransformer, err error) { var internal C.cudnnSpatialTransformerDescriptor_t if err := result(C.cudnnCreateSpatialTransformerDescriptor(&internal)); err != nil { return nil, err } dimAC, dimACManaged :=...
[ "func", "NewSpatialTransformer", "(", "samplerType", "SamplerType", ",", "dataType", "DataType", ",", "nbDims", "int", ",", "dimA", "[", "]", "int", ")", "(", "retVal", "*", "SpatialTransformer", ",", "err", "error", ")", "{", "var", "internal", "C", ".", ...
// NewSpatialTransformer creates a new SpatialTransformer.
[ "NewSpatialTransformer", "creates", "a", "new", "SpatialTransformer", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/dnn/generated_spatialtransformer.go#L22-L43
127,529
gorgonia/cu
cmd/gencublas/binding.go
GoTypeForEnum
func GoTypeForEnum(typ cc.Type, name string, types ...map[string]bg.Template) string { if typ == nil { return "<nil>" } if typ.Kind() != cc.Enum { panic(fmt.Sprintf("invalid type: %v", typ)) } tag := typ.Tag() if tag != 0 { n := string(xc.Dict.S(tag)) for _, t := range types { if s, ok := t[n]; ok { ...
go
func GoTypeForEnum(typ cc.Type, name string, types ...map[string]bg.Template) string { if typ == nil { return "<nil>" } if typ.Kind() != cc.Enum { panic(fmt.Sprintf("invalid type: %v", typ)) } tag := typ.Tag() if tag != 0 { n := string(xc.Dict.S(tag)) for _, t := range types { if s, ok := t[n]; ok { ...
[ "func", "GoTypeForEnum", "(", "typ", "cc", ".", "Type", ",", "name", "string", ",", "types", "...", "map", "[", "string", "]", "bg", ".", "Template", ")", "string", "{", "if", "typ", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "if", ...
// GoTypeForEnum returns a string representation of the given enum type using a mapping // in types. GoTypeForEnum will panic if no type mapping is found after searching the // user-provided types mappings or the type is not an enum.
[ "GoTypeForEnum", "returns", "a", "string", "representation", "of", "the", "given", "enum", "type", "using", "a", "mapping", "in", "types", ".", "GoTypeForEnum", "will", "panic", "if", "no", "type", "mapping", "is", "found", "after", "searching", "the", "user",...
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/cmd/gencublas/binding.go#L89-L112
127,530
gorgonia/cu
cmd/gencublas/binding.go
LowerCaseFirst
func LowerCaseFirst(s string) string { if len(s) == 0 { return s } return string(s[0]|' ') + s[1:] }
go
func LowerCaseFirst(s string) string { if len(s) == 0 { return s } return string(s[0]|' ') + s[1:] }
[ "func", "LowerCaseFirst", "(", "s", "string", ")", "string", "{", "if", "len", "(", "s", ")", "==", "0", "{", "return", "s", "\n", "}", "\n", "return", "string", "(", "s", "[", "0", "]", "|", "' '", ")", "+", "s", "[", "1", ":", "]", "\n", ...
// LowerCaseFirst returns s with the first character lower-cased. LowerCaseFirst // assumes s is an ASCII-represented string.
[ "LowerCaseFirst", "returns", "s", "with", "the", "first", "character", "lower", "-", "cased", ".", "LowerCaseFirst", "assumes", "s", "is", "an", "ASCII", "-", "represented", "string", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/cmd/gencublas/binding.go#L221-L226
127,531
gorgonia/cu
cmd/gencublas/binding.go
UpperCaseFirst
func UpperCaseFirst(s string) string { if len(s) == 0 { return s } return string(s[0]&^' ') + s[1:] }
go
func UpperCaseFirst(s string) string { if len(s) == 0 { return s } return string(s[0]&^' ') + s[1:] }
[ "func", "UpperCaseFirst", "(", "s", "string", ")", "string", "{", "if", "len", "(", "s", ")", "==", "0", "{", "return", "s", "\n", "}", "\n", "return", "string", "(", "s", "[", "0", "]", "&^", "' '", ")", "+", "s", "[", "1", ":", "]", "\n", ...
// UpperCaseFirst returns s with the first character upper-cased. UpperCaseFirst // assumes s is an ASCII-represented string.
[ "UpperCaseFirst", "returns", "s", "with", "the", "first", "character", "upper", "-", "cased", ".", "UpperCaseFirst", "assumes", "s", "is", "an", "ASCII", "-", "represented", "string", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/cmd/gencublas/binding.go#L230-L235
127,532
gorgonia/cu
cmd/gencublas/binding.go
functions
func functions(t *cc.TranslationUnit) ([]bg.Declaration, error) { filter := func(d *cc.Declarator) bool { if d.Type.Kind() != cc.Function { return false } return true } return bg.Get(t, filter) }
go
func functions(t *cc.TranslationUnit) ([]bg.Declaration, error) { filter := func(d *cc.Declarator) bool { if d.Type.Kind() != cc.Function { return false } return true } return bg.Get(t, filter) }
[ "func", "functions", "(", "t", "*", "cc", ".", "TranslationUnit", ")", "(", "[", "]", "bg", ".", "Declaration", ",", "error", ")", "{", "filter", ":=", "func", "(", "d", "*", "cc", ".", "Declarator", ")", "bool", "{", "if", "d", ".", "Type", ".",...
// functions say we only want functions declared
[ "functions", "say", "we", "only", "want", "functions", "declared" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/cmd/gencublas/binding.go#L276-L284
127,533
gorgonia/cu
dnn/filter.go
NewFilter
func NewFilter(dataType DataType, format TensorFormat, shape []int) (retVal *Filter, err error) { var internal C.cudnnFilterDescriptor_t if err = result(C.cudnnCreateFilterDescriptor(&internal)); err != nil { return nil, err } switch len(shape) { case 0, 1, 2, 3: return nil, errors.New("Cannot create filter wi...
go
func NewFilter(dataType DataType, format TensorFormat, shape []int) (retVal *Filter, err error) { var internal C.cudnnFilterDescriptor_t if err = result(C.cudnnCreateFilterDescriptor(&internal)); err != nil { return nil, err } switch len(shape) { case 0, 1, 2, 3: return nil, errors.New("Cannot create filter wi...
[ "func", "NewFilter", "(", "dataType", "DataType", ",", "format", "TensorFormat", ",", "shape", "[", "]", "int", ")", "(", "retVal", "*", "Filter", ",", "err", "error", ")", "{", "var", "internal", "C", ".", "cudnnFilterDescriptor_t", "\n", "if", "err", "...
// NewFilter creates a new Filter.
[ "NewFilter", "creates", "a", "new", "Filter", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/dnn/filter.go#L21-L45
127,534
gorgonia/cu
dnn/filter.go
Shape
func (f *Filter) Shape() []int { retVal := make([]int, len(f.shape)) copy(retVal, f.shape) return retVal }
go
func (f *Filter) Shape() []int { retVal := make([]int, len(f.shape)) copy(retVal, f.shape) return retVal }
[ "func", "(", "f", "*", "Filter", ")", "Shape", "(", ")", "[", "]", "int", "{", "retVal", ":=", "make", "(", "[", "]", "int", ",", "len", "(", "f", ".", "shape", ")", ")", "\n", "copy", "(", "retVal", ",", "f", ".", "shape", ")", "\n", "retu...
// Shape returns a copy of the shape.
[ "Shape", "returns", "a", "copy", "of", "the", "shape", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/dnn/filter.go#L54-L58
127,535
gorgonia/cu
dnn/interop/interop.go
Describe
func Describe(t Tensor) (*cudnn.TensorDescriptor, error) { shape := t.Shape().Clone() strides := make([]int, len(shape)) copy(strides, t.Strides()) switch shape.Dims() { case 0: // TODO? case 1: // TODO? case 2: // take a 2D shape and make it 4D: // because Gorgonia only takes NCHW formats // any 2D m...
go
func Describe(t Tensor) (*cudnn.TensorDescriptor, error) { shape := t.Shape().Clone() strides := make([]int, len(shape)) copy(strides, t.Strides()) switch shape.Dims() { case 0: // TODO? case 1: // TODO? case 2: // take a 2D shape and make it 4D: // because Gorgonia only takes NCHW formats // any 2D m...
[ "func", "Describe", "(", "t", "Tensor", ")", "(", "*", "cudnn", ".", "TensorDescriptor", ",", "error", ")", "{", "shape", ":=", "t", ".", "Shape", "(", ")", ".", "Clone", "(", ")", "\n", "strides", ":=", "make", "(", "[", "]", "int", ",", "len", ...
// Describe extracts the metadata from a tensor.Dense and returns a cuDNN TensorDescriptor
[ "Describe", "extracts", "the", "metadata", "from", "a", "tensor", ".", "Dense", "and", "returns", "a", "cuDNN", "TensorDescriptor" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/dnn/interop/interop.go#L22-L58
127,536
gorgonia/cu
dnn/interop/interop.go
Dtype2DataType
func Dtype2DataType(t tensor.Dtype) cudnn.DataType { switch t.Name() { case "float64": return cudnn.Double case "float32": return cudnn.Float case "float16": return cudnn.Half case "int8": return cudnn.Int8 case "int32": return cudnn.Int32 case "int128": return cudnn.Int8x4 } panic("Unreachable") }
go
func Dtype2DataType(t tensor.Dtype) cudnn.DataType { switch t.Name() { case "float64": return cudnn.Double case "float32": return cudnn.Float case "float16": return cudnn.Half case "int8": return cudnn.Int8 case "int32": return cudnn.Int32 case "int128": return cudnn.Int8x4 } panic("Unreachable") }
[ "func", "Dtype2DataType", "(", "t", "tensor", ".", "Dtype", ")", "cudnn", ".", "DataType", "{", "switch", "t", ".", "Name", "(", ")", "{", "case", "\"", "\"", ":", "return", "cudnn", ".", "Double", "\n", "case", "\"", "\"", ":", "return", "cudnn", ...
// Dtype2DataType converts a tensor.Dtype to a cudnnDataType.
[ "Dtype2DataType", "converts", "a", "tensor", ".", "Dtype", "to", "a", "cudnnDataType", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/dnn/interop/interop.go#L66-L82
127,537
gorgonia/cu
cmd/gencudnn/main.go
goimports
func goimports(filename string) error { cmd := exec.Command("goimports", "-w", filename) return cmd.Run() }
go
func goimports(filename string) error { cmd := exec.Command("goimports", "-w", filename) return cmd.Run() }
[ "func", "goimports", "(", "filename", "string", ")", "error", "{", "cmd", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ",", "filename", ")", "\n", "return", "cmd", ".", "Run", "(", ")", "\n", "}" ]
// yes I know goimports can be imported, but I'm lazy
[ "yes", "I", "know", "goimports", "can", "be", "imported", "but", "I", "m", "lazy" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/cmd/gencudnn/main.go#L49-L52
127,538
gorgonia/cu
cmd/gencudnn/main.go
reportPotentialNils
func reportPotentialNils(pkg *PkgState) { nils := pkg.checkNils() if len(nils) > 0 { fmt.Printf("## Potential Nils ##\nThese functions have a `*T` return value, but a possible null exception error might happen\n\n") for _, n := range nils { fmt.Printf("* `%v`\n", n) } } fmt.Println() }
go
func reportPotentialNils(pkg *PkgState) { nils := pkg.checkNils() if len(nils) > 0 { fmt.Printf("## Potential Nils ##\nThese functions have a `*T` return value, but a possible null exception error might happen\n\n") for _, n := range nils { fmt.Printf("* `%v`\n", n) } } fmt.Println() }
[ "func", "reportPotentialNils", "(", "pkg", "*", "PkgState", ")", "{", "nils", ":=", "pkg", ".", "checkNils", "(", ")", "\n", "if", "len", "(", "nils", ")", ">", "0", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\\n", "\\n", "\"", ")", "\n", "for...
// find potential nils
[ "find", "potential", "nils" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/cmd/gencudnn/main.go#L94-L103
127,539
gorgonia/cu
dnn/optensor.go
NewOp
func NewOp(op OpTensorOp, dt DataType, prop NanPropagation) (*Op, error) { var internal C.cudnnOpTensorDescriptor_t if err := result(C.cudnnCreateOpTensorDescriptor(&internal)); err != nil { return nil, err } if err := result(C.cudnnSetOpTensorDescriptor(internal, op.C(), dt.C(), prop.C())); err != nil { retur...
go
func NewOp(op OpTensorOp, dt DataType, prop NanPropagation) (*Op, error) { var internal C.cudnnOpTensorDescriptor_t if err := result(C.cudnnCreateOpTensorDescriptor(&internal)); err != nil { return nil, err } if err := result(C.cudnnSetOpTensorDescriptor(internal, op.C(), dt.C(), prop.C())); err != nil { retur...
[ "func", "NewOp", "(", "op", "OpTensorOp", ",", "dt", "DataType", ",", "prop", "NanPropagation", ")", "(", "*", "Op", ",", "error", ")", "{", "var", "internal", "C", ".", "cudnnOpTensorDescriptor_t", "\n", "if", "err", ":=", "result", "(", "C", ".", "cu...
// NewOp creates a new Op with the provided settings
[ "NewOp", "creates", "a", "new", "Op", "with", "the", "provided", "settings" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/dnn/optensor.go#L22-L39
127,540
gorgonia/cu
dnn/optensor.go
DoOp
func (ctx *Context) DoOp(op *Op, alpha1 float64, aDesc *TensorDescriptor, aData Memory, alpha2 float64, bDesc *TensorDescriptor, bData Memory, beta float64, cDesc *TensorDescriptor, cData Memory) error { // dtype checks if !(aDesc.dataType == bDesc.dataType && bDesc.dataType == cDesc.dataType) { return errors.E...
go
func (ctx *Context) DoOp(op *Op, alpha1 float64, aDesc *TensorDescriptor, aData Memory, alpha2 float64, bDesc *TensorDescriptor, bData Memory, beta float64, cDesc *TensorDescriptor, cData Memory) error { // dtype checks if !(aDesc.dataType == bDesc.dataType && bDesc.dataType == cDesc.dataType) { return errors.E...
[ "func", "(", "ctx", "*", "Context", ")", "DoOp", "(", "op", "*", "Op", ",", "alpha1", "float64", ",", "aDesc", "*", "TensorDescriptor", ",", "aData", "Memory", ",", "alpha2", "float64", ",", "bDesc", "*", "TensorDescriptor", ",", "bData", "Memory", ",", ...
// DoOp actually performs the operation.
[ "DoOp", "actually", "performs", "the", "operation", "." ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/dnn/optensor.go#L51-L109
127,541
gorgonia/cu
dnn/shape.go
shapeEq
func shapeEq(a, b []int) bool { if isScalar(a) && isScalar(b) { return true } if len(a) != len(b) { return false } for i, v := range a { if b[i] != v { return false } } return true }
go
func shapeEq(a, b []int) bool { if isScalar(a) && isScalar(b) { return true } if len(a) != len(b) { return false } for i, v := range a { if b[i] != v { return false } } return true }
[ "func", "shapeEq", "(", "a", ",", "b", "[", "]", "int", ")", "bool", "{", "if", "isScalar", "(", "a", ")", "&&", "isScalar", "(", "b", ")", "{", "return", "true", "\n", "}", "\n\n", "if", "len", "(", "a", ")", "!=", "len", "(", "b", ")", "{...
// shapeEq is adapted from tensor
[ "shapeEq", "is", "adapted", "from", "tensor" ]
89152d7e441439045736bc7640ff607ec371c26c
https://github.com/gorgonia/cu/blob/89152d7e441439045736bc7640ff607ec371c26c/dnn/shape.go#L8-L23
127,542
balzaczyy/golucene
core/codec/spi/segmentCommitInfo.go
Files
func (si *SegmentCommitInfo) Files() []string { // Start from the wrapped info's files: files := make(map[string]bool) for name, _ := range si.Info.Files() { files[name] = true } // Must separately add any live docs files for _, name := range si.Info.Codec().(Codec).LiveDocsFormat().Files(si) { files[name] =...
go
func (si *SegmentCommitInfo) Files() []string { // Start from the wrapped info's files: files := make(map[string]bool) for name, _ := range si.Info.Files() { files[name] = true } // Must separately add any live docs files for _, name := range si.Info.Codec().(Codec).LiveDocsFormat().Files(si) { files[name] =...
[ "func", "(", "si", "*", "SegmentCommitInfo", ")", "Files", "(", ")", "[", "]", "string", "{", "// Start from the wrapped info's files:", "files", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n", "for", "name", ",", "_", ":=", "range", "si...
// Returns all files in use by this segment.
[ "Returns", "all", "files", "in", "use", "by", "this", "segment", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/codec/spi/segmentCommitInfo.go#L124-L161
127,543
balzaczyy/golucene
core/index/live.go
newLiveIndexWriterConfig
func newLiveIndexWriterConfig(analyzer analysis.Analyzer, matchVersion util.Version) *LiveIndexWriterConfigImpl { assert(DefaultSimilarity != nil) assert(DefaultCodec != nil) return &LiveIndexWriterConfigImpl{ analyzer: analyzer, matchVersion: matchVersion, ramBufferSizeMB: ...
go
func newLiveIndexWriterConfig(analyzer analysis.Analyzer, matchVersion util.Version) *LiveIndexWriterConfigImpl { assert(DefaultSimilarity != nil) assert(DefaultCodec != nil) return &LiveIndexWriterConfigImpl{ analyzer: analyzer, matchVersion: matchVersion, ramBufferSizeMB: ...
[ "func", "newLiveIndexWriterConfig", "(", "analyzer", "analysis", ".", "Analyzer", ",", "matchVersion", "util", ".", "Version", ")", "*", "LiveIndexWriterConfigImpl", "{", "assert", "(", "DefaultSimilarity", "!=", "nil", ")", "\n", "assert", "(", "DefaultCodec", "!...
// used by IndexWriterConfig
[ "used", "by", "IndexWriterConfig" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/index/live.go#L100-L129
127,544
balzaczyy/golucene
core/store/compound.go
FileLength
func (d *CompoundFileDirectory) FileLength(name string) (n int64, err error) { panic("not implemented yet") }
go
func (d *CompoundFileDirectory) FileLength(name string) (n int64, err error) { panic("not implemented yet") }
[ "func", "(", "d", "*", "CompoundFileDirectory", ")", "FileLength", "(", "name", "string", ")", "(", "n", "int64", ",", "err", "error", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}" ]
// Returns the length of a file in the directory.
[ "Returns", "the", "length", "of", "a", "file", "in", "the", "directory", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/store/compound.go#L165-L167
127,545
balzaczyy/golucene
core/util/automaton/regexp.go
NewRegExpWithFlag
func NewRegExpWithFlag(s string, flags int) *RegExp { ans := &RegExp{ b: []rune(s), flags: flags, } var e *RegExp if len(s) == 0 { e = makeStringRE("") } else { e = ans.parseUnionExp() if ans.pos < len(ans.b) { panic(fmt.Sprintf("end-of-string expected at position %v", ans.pos)) } } ans.kind =...
go
func NewRegExpWithFlag(s string, flags int) *RegExp { ans := &RegExp{ b: []rune(s), flags: flags, } var e *RegExp if len(s) == 0 { e = makeStringRE("") } else { e = ans.parseUnionExp() if ans.pos < len(ans.b) { panic(fmt.Sprintf("end-of-string expected at position %v", ans.pos)) } } ans.kind =...
[ "func", "NewRegExpWithFlag", "(", "s", "string", ",", "flags", "int", ")", "*", "RegExp", "{", "ans", ":=", "&", "RegExp", "{", "b", ":", "[", "]", "rune", "(", "s", ")", ",", "flags", ":", "flags", ",", "}", "\n", "var", "e", "*", "RegExp", "\...
// Constructs new RegExp from a string.
[ "Constructs", "new", "RegExp", "from", "a", "string", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/util/automaton/regexp.go#L118-L140
127,546
balzaczyy/golucene
core/util/automaton/regexp.go
String
func (re *RegExp) String() string { var b bytes.Buffer return re.toStringBuilder(&b).String() }
go
func (re *RegExp) String() string { var b bytes.Buffer return re.toStringBuilder(&b).String() }
[ "func", "(", "re", "*", "RegExp", ")", "String", "(", ")", "string", "{", "var", "b", "bytes", ".", "Buffer", "\n", "return", "re", ".", "toStringBuilder", "(", "&", "b", ")", ".", "String", "(", ")", "\n", "}" ]
// Constructs string from parsed regular expression
[ "Constructs", "string", "from", "parsed", "regular", "expression" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/util/automaton/regexp.go#L215-L218
127,547
balzaczyy/golucene
core/codec/compressing/storedFieldsReader.go
newCompressingStoredFieldsReaderFrom
func newCompressingStoredFieldsReaderFrom(reader *CompressingStoredFieldsReader) *CompressingStoredFieldsReader { return &CompressingStoredFieldsReader{ version: reader.version, fieldInfos: reader.fieldInfos, fieldsStream: reader.fieldsStream.Clone(), indexReader: reader.indexReader...
go
func newCompressingStoredFieldsReaderFrom(reader *CompressingStoredFieldsReader) *CompressingStoredFieldsReader { return &CompressingStoredFieldsReader{ version: reader.version, fieldInfos: reader.fieldInfos, fieldsStream: reader.fieldsStream.Clone(), indexReader: reader.indexReader...
[ "func", "newCompressingStoredFieldsReaderFrom", "(", "reader", "*", "CompressingStoredFieldsReader", ")", "*", "CompressingStoredFieldsReader", "{", "return", "&", "CompressingStoredFieldsReader", "{", "version", ":", "reader", ".", "version", ",", "fieldInfos", ":", "rea...
// used by clone
[ "used", "by", "clone" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/codec/compressing/storedFieldsReader.go#L37-L52
127,548
balzaczyy/golucene
core/codec/compressing/storedFieldsReader.go
Close
func (r *CompressingStoredFieldsReader) Close() (err error) { if !r.closed { if err = util.Close(r.fieldsStream); err == nil { r.closed = true } } return }
go
func (r *CompressingStoredFieldsReader) Close() (err error) { if !r.closed { if err = util.Close(r.fieldsStream); err == nil { r.closed = true } } return }
[ "func", "(", "r", "*", "CompressingStoredFieldsReader", ")", "Close", "(", ")", "(", "err", "error", ")", "{", "if", "!", "r", ".", "closed", "{", "if", "err", "=", "util", ".", "Close", "(", "r", ".", "fieldsStream", ")", ";", "err", "==", "nil", ...
// Close the underlying IndexInputs
[ "Close", "the", "underlying", "IndexInputs" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/codec/compressing/storedFieldsReader.go#L172-L179
127,549
balzaczyy/golucene
core/codec/lucene41/postingsReader.go
readVIntBlock
func readVIntBlock(docIn store.IndexInput, docBuffer []int, freqBuffer []int, num int, indexHasFreq bool) (err error) { if indexHasFreq { for i := 0; i < num; i++ { code, err := asInt(docIn.ReadVInt()) if err != nil { return err } docBuffer[i] = int(uint(code) >> 1) if (code & 1) != 0 { freqB...
go
func readVIntBlock(docIn store.IndexInput, docBuffer []int, freqBuffer []int, num int, indexHasFreq bool) (err error) { if indexHasFreq { for i := 0; i < num; i++ { code, err := asInt(docIn.ReadVInt()) if err != nil { return err } docBuffer[i] = int(uint(code) >> 1) if (code & 1) != 0 { freqB...
[ "func", "readVIntBlock", "(", "docIn", "store", ".", "IndexInput", ",", "docBuffer", "[", "]", "int", ",", "freqBuffer", "[", "]", "int", ",", "num", "int", ",", "indexHasFreq", "bool", ")", "(", "err", "error", ")", "{", "if", "indexHasFreq", "{", "fo...
/** * Read values that have been written using variable-length encoding instead of bit-packing. */
[ "Read", "values", "that", "have", "been", "written", "using", "variable", "-", "length", "encoding", "instead", "of", "bit", "-", "packing", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/codec/lucene41/postingsReader.go#L136-L163
127,550
balzaczyy/golucene
core/index/invertedDocConsumerPerField.go
utf8ToString
func utf8ToString(iso8859_1_buf []byte) string { buf := make([]rune, len(iso8859_1_buf)) for i, b := range iso8859_1_buf { buf[i] = rune(b) } return string(buf) }
go
func utf8ToString(iso8859_1_buf []byte) string { buf := make([]rune, len(iso8859_1_buf)) for i, b := range iso8859_1_buf { buf[i] = rune(b) } return string(buf) }
[ "func", "utf8ToString", "(", "iso8859_1_buf", "[", "]", "byte", ")", "string", "{", "buf", ":=", "make", "(", "[", "]", "rune", ",", "len", "(", "iso8859_1_buf", ")", ")", "\n", "for", "i", ",", "b", ":=", "range", "iso8859_1_buf", "{", "buf", "[", ...
// Simpler version of Lucene's own method
[ "Simpler", "version", "of", "Lucene", "s", "own", "method" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/index/invertedDocConsumerPerField.go#L179-L185
127,551
balzaczyy/golucene
core/index/writer.go
ensureOpen
func (cc *ClosingControl) ensureOpen(failIfClosing bool) { assert2(!cc._closed && (!failIfClosing || !cc._closing), "this IndexWriter is closed") }
go
func (cc *ClosingControl) ensureOpen(failIfClosing bool) { assert2(!cc._closed && (!failIfClosing || !cc._closing), "this IndexWriter is closed") }
[ "func", "(", "cc", "*", "ClosingControl", ")", "ensureOpen", "(", "failIfClosing", "bool", ")", "{", "assert2", "(", "!", "cc", ".", "_closed", "&&", "(", "!", "failIfClosing", "||", "!", "cc", ".", "_closing", ")", ",", "\"", "\"", ")", "\n", "}" ]
// Used internally to throw an AlreadyClosedError if this IndexWriter // has been closed or is in the process of closing.
[ "Used", "internally", "to", "throw", "an", "AlreadyClosedError", "if", "this", "IndexWriter", "has", "been", "closed", "or", "is", "in", "the", "process", "of", "closing", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/index/writer.go#L121-L123
127,552
balzaczyy/golucene
core/index/writer.go
segString
func (w *IndexWriter) segString() string { // TODO synchronized return w.readerPool.segmentsToString(w.segmentInfos.Segments) }
go
func (w *IndexWriter) segString() string { // TODO synchronized return w.readerPool.segmentsToString(w.segmentInfos.Segments) }
[ "func", "(", "w", "*", "IndexWriter", ")", "segString", "(", ")", "string", "{", "// TODO synchronized", "return", "w", ".", "readerPool", ".", "segmentsToString", "(", "w", ".", "segmentInfos", ".", "Segments", ")", "\n", "}" ]
// Returns a string description of all segments, for debugging.
[ "Returns", "a", "string", "description", "of", "all", "segments", "for", "debugging", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/index/writer.go#L1456-L1459
127,553
balzaczyy/golucene
core/index/writer.go
assertFilesExist
func (w *IndexWriter) assertFilesExist(toSync *SegmentInfos) error { files := toSync.files(w.directory, false) for _, filename := range files { allFiles, err := w.directory.ListAll() if err != nil { return err } ok, err := w.slowFileExists(w.directory, filename) if err != nil { return err } assert...
go
func (w *IndexWriter) assertFilesExist(toSync *SegmentInfos) error { files := toSync.files(w.directory, false) for _, filename := range files { allFiles, err := w.directory.ListAll() if err != nil { return err } ok, err := w.slowFileExists(w.directory, filename) if err != nil { return err } assert...
[ "func", "(", "w", "*", "IndexWriter", ")", "assertFilesExist", "(", "toSync", "*", "SegmentInfos", ")", "error", "{", "files", ":=", "toSync", ".", "files", "(", "w", ".", "directory", ",", "false", ")", "\n", "for", "_", ",", "filename", ":=", "range"...
// called only from assert
[ "called", "only", "from", "assert" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/index/writer.go#L1462-L1481
127,554
balzaczyy/golucene
core/index/writer.go
deleteNewFiles
func (w *IndexWriter) deleteNewFiles(files []string) error { w.Lock() // synchronized defer w.Unlock() panic("not implemented yet") }
go
func (w *IndexWriter) deleteNewFiles(files []string) error { w.Lock() // synchronized defer w.Unlock() panic("not implemented yet") }
[ "func", "(", "w", "*", "IndexWriter", ")", "deleteNewFiles", "(", "files", "[", "]", "string", ")", "error", "{", "w", ".", "Lock", "(", ")", "// synchronized", "\n", "defer", "w", ".", "Unlock", "(", ")", "\n", "panic", "(", "\"", "\"", ")", "\n",...
// Tries to delete the given files if unreferenced.
[ "Tries", "to", "delete", "the", "given", "files", "if", "unreferenced", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/index/writer.go#L1721-L1725
127,555
balzaczyy/golucene
core/document/field.go
NewFieldFromString
func NewFieldFromString(name, value string, ft *FieldType) *Field { assert2(name != "", "name cannot be empty") assert2(value != "", "value cannot be empty") assert2(ft.stored || ft.indexed, "it doesn't make sense to have a field that is neither indexed nor stored") return &Field{_type: ft, _name: name, _data: va...
go
func NewFieldFromString(name, value string, ft *FieldType) *Field { assert2(name != "", "name cannot be empty") assert2(value != "", "value cannot be empty") assert2(ft.stored || ft.indexed, "it doesn't make sense to have a field that is neither indexed nor stored") return &Field{_type: ft, _name: name, _data: va...
[ "func", "NewFieldFromString", "(", "name", ",", "value", "string", ",", "ft", "*", "FieldType", ")", "*", "Field", "{", "assert2", "(", "name", "!=", "\"", "\"", ",", "\"", "\"", ")", "\n", "assert2", "(", "value", "!=", "\"", "\"", ",", "\"", "\""...
// Create field with String value
[ "Create", "field", "with", "String", "value" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/document/field.go#L42-L48
127,556
balzaczyy/golucene
core/codec/blocktree/segmentTermEnum.go
pushFrame
func (e *SegmentTermsEnum) pushFrame(arc *fst.Arc, frameData []byte, length int) (f *segmentTermsEnumFrame, err error) { // fmt.Println("Pushing frame...") e.scratchReader.Reset(frameData) code, err := e.scratchReader.ReadVLong() if err != nil { return nil, err } fpSeek := int64(uint64(code) >> BTT_OUTPUT_FLAGS...
go
func (e *SegmentTermsEnum) pushFrame(arc *fst.Arc, frameData []byte, length int) (f *segmentTermsEnumFrame, err error) { // fmt.Println("Pushing frame...") e.scratchReader.Reset(frameData) code, err := e.scratchReader.ReadVLong() if err != nil { return nil, err } fpSeek := int64(uint64(code) >> BTT_OUTPUT_FLAGS...
[ "func", "(", "e", "*", "SegmentTermsEnum", ")", "pushFrame", "(", "arc", "*", "fst", ".", "Arc", ",", "frameData", "[", "]", "byte", ",", "length", "int", ")", "(", "f", "*", "segmentTermsEnumFrame", ",", "err", "error", ")", "{", "// fmt.Println(\"Pushi...
// Pushes a frame we seek'd to
[ "Pushes", "a", "frame", "we", "seek", "d", "to" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/codec/blocktree/segmentTermEnum.go#L134-L151
127,557
balzaczyy/golucene
core/codec/blocktree/segmentTermEnum.go
pushFrameAt
func (e *SegmentTermsEnum) pushFrameAt(arc *fst.Arc, fp int64, length int) (f *segmentTermsEnumFrame, err error) { f = e.frame(1 + e.currentFrame.ord) f.arc = arc if f.fpOrig == fp && f.nextEnt != -1 { // fmt.Printf(" push reused frame ord=%v fp=%v isFloor?=%v hasTerms=%v pref=%v nextEnt=%v targetBeforeCurren...
go
func (e *SegmentTermsEnum) pushFrameAt(arc *fst.Arc, fp int64, length int) (f *segmentTermsEnumFrame, err error) { f = e.frame(1 + e.currentFrame.ord) f.arc = arc if f.fpOrig == fp && f.nextEnt != -1 { // fmt.Printf(" push reused frame ord=%v fp=%v isFloor?=%v hasTerms=%v pref=%v nextEnt=%v targetBeforeCurren...
[ "func", "(", "e", "*", "SegmentTermsEnum", ")", "pushFrameAt", "(", "arc", "*", "fst", ".", "Arc", ",", "fp", "int64", ",", "length", "int", ")", "(", "f", "*", "segmentTermsEnumFrame", ",", "err", "error", ")", "{", "f", "=", "e", ".", "frame", "(...
// Pushes next'd frame or seek'd frame; we later // lazy-load the frame only when needed
[ "Pushes", "next", "d", "frame", "or", "seek", "d", "frame", ";", "we", "later", "lazy", "-", "load", "the", "frame", "only", "when", "needed" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/codec/blocktree/segmentTermEnum.go#L155-L179
127,558
balzaczyy/golucene
core/codec/spi/codec.go
LoadCodec
func LoadCodec(name string) Codec { c, ok := allCodecs[name] if !ok { fmt.Println("Unknown codec:", name) fmt.Println("Available codecs:", allCodecs) assert(ok) } return c }
go
func LoadCodec(name string) Codec { c, ok := allCodecs[name] if !ok { fmt.Println("Unknown codec:", name) fmt.Println("Available codecs:", allCodecs) assert(ok) } return c }
[ "func", "LoadCodec", "(", "name", "string", ")", "Codec", "{", "c", ",", "ok", ":=", "allCodecs", "[", "name", "]", "\n", "if", "!", "ok", "{", "fmt", ".", "Println", "(", "\"", "\"", ",", "name", ")", "\n", "fmt", ".", "Println", "(", "\"", "\...
// looks up a codec by name
[ "looks", "up", "a", "codec", "by", "name" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/codec/spi/codec.go#L124-L132
127,559
balzaczyy/golucene
core/codec/spi/codec.go
AvailableCodecs
func AvailableCodecs() []string { ans := make([]string, 0, len(allCodecs)) for name, _ := range allCodecs { ans = append(ans, name) } return ans }
go
func AvailableCodecs() []string { ans := make([]string, 0, len(allCodecs)) for name, _ := range allCodecs { ans = append(ans, name) } return ans }
[ "func", "AvailableCodecs", "(", ")", "[", "]", "string", "{", "ans", ":=", "make", "(", "[", "]", "string", ",", "0", ",", "len", "(", "allCodecs", ")", ")", "\n", "for", "name", ",", "_", ":=", "range", "allCodecs", "{", "ans", "=", "append", "(...
// returns a list of all available codec names
[ "returns", "a", "list", "of", "all", "available", "codec", "names" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/codec/spi/codec.go#L135-L141
127,560
balzaczyy/golucene
core/util/packed/packed.go
CheckVersion
func CheckVersion(version int32) { if version < PACKED_VERSION_START { panic(fmt.Sprintf("Version is too old, should be at least %v (got %v)", PACKED_VERSION_START, version)) } else if version > VERSION_CURRENT { panic(fmt.Sprintf("Version is too new, should be at most %v (got %v)", VERSION_CURRENT, version)) } ...
go
func CheckVersion(version int32) { if version < PACKED_VERSION_START { panic(fmt.Sprintf("Version is too old, should be at least %v (got %v)", PACKED_VERSION_START, version)) } else if version > VERSION_CURRENT { panic(fmt.Sprintf("Version is too new, should be at most %v (got %v)", VERSION_CURRENT, version)) } ...
[ "func", "CheckVersion", "(", "version", "int32", ")", "{", "if", "version", "<", "PACKED_VERSION_START", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "PACKED_VERSION_START", ",", "version", ")", ")", "\n", "}", "else", "if", "version", ...
// Ceck the validity of a version number
[ "Ceck", "the", "validity", "of", "a", "version", "number" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/util/packed/packed.go#L54-L60
127,561
balzaczyy/golucene
core/util/packed/packed.go
IsSupported
func (f PackedFormat) IsSupported(bitsPerValue int) bool { switch int(f) { case PACKED_SINGLE_BLOCK: return is64Supported(bitsPerValue) } return bitsPerValue >= 1 && bitsPerValue <= 64 }
go
func (f PackedFormat) IsSupported(bitsPerValue int) bool { switch int(f) { case PACKED_SINGLE_BLOCK: return is64Supported(bitsPerValue) } return bitsPerValue >= 1 && bitsPerValue <= 64 }
[ "func", "(", "f", "PackedFormat", ")", "IsSupported", "(", "bitsPerValue", "int", ")", "bool", "{", "switch", "int", "(", "f", ")", "{", "case", "PACKED_SINGLE_BLOCK", ":", "return", "is64Supported", "(", "bitsPerValue", ")", "\n", "}", "\n", "return", "bi...
/** * Tests whether the provided number of bits per value is supported by the * format. */
[ "Tests", "whether", "the", "provided", "number", "of", "bits", "per", "value", "is", "supported", "by", "the", "format", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/util/packed/packed.go#L118-L124
127,562
balzaczyy/golucene
core/util/wrapper.go
Set
func (so *SetOnce) Set(obj interface{}) { so.Do(func() { so.obj = obj }) assert2(so.obj == obj, "The object cannot be set twice!") }
go
func (so *SetOnce) Set(obj interface{}) { so.Do(func() { so.obj = obj }) assert2(so.obj == obj, "The object cannot be set twice!") }
[ "func", "(", "so", "*", "SetOnce", ")", "Set", "(", "obj", "interface", "{", "}", ")", "{", "so", ".", "Do", "(", "func", "(", ")", "{", "so", ".", "obj", "=", "obj", "}", ")", "\n", "assert2", "(", "so", ".", "obj", "==", "obj", ",", "\"",...
// Sets the given object. If the object has already been set, an exception is thrown.
[ "Sets", "the", "given", "object", ".", "If", "the", "object", "has", "already", "been", "set", "an", "exception", "is", "thrown", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/util/wrapper.go#L30-L33
127,563
balzaczyy/golucene
core/index/deleter.go
onCommit
func (p KeepOnlyLastCommitDeletionPolicy) onCommit(commits []IndexCommit) error { // Note that len(commits) should normally be 2 (if not called by // onInit above). for i, limit := 0, len(commits); i < limit-1; i++ { commits[i].Delete() } return nil }
go
func (p KeepOnlyLastCommitDeletionPolicy) onCommit(commits []IndexCommit) error { // Note that len(commits) should normally be 2 (if not called by // onInit above). for i, limit := 0, len(commits); i < limit-1; i++ { commits[i].Delete() } return nil }
[ "func", "(", "p", "KeepOnlyLastCommitDeletionPolicy", ")", "onCommit", "(", "commits", "[", "]", "IndexCommit", ")", "error", "{", "// Note that len(commits) should normally be 2 (if not called by", "// onInit above).", "for", "i", ",", "limit", ":=", "0", ",", "len", ...
// Deletes all commits except the most recent one.
[ "Deletes", "all", "commits", "except", "the", "most", "recent", "one", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/index/deleter.go#L91-L98
127,564
balzaczyy/golucene
core/index/readerPool.go
dropAll
func (pool *ReaderPool) dropAll(doSave bool) error { pool.Lock() // synchronized defer pool.Unlock() var priorE error for len(pool.readerMap) > 0 { for k, rld := range pool.readerMap { if doSave { ok, err := rld.writeLiveDocs(pool.owner.directory) if err != nil { return err } if ok { ...
go
func (pool *ReaderPool) dropAll(doSave bool) error { pool.Lock() // synchronized defer pool.Unlock() var priorE error for len(pool.readerMap) > 0 { for k, rld := range pool.readerMap { if doSave { ok, err := rld.writeLiveDocs(pool.owner.directory) if err != nil { return err } if ok { ...
[ "func", "(", "pool", "*", "ReaderPool", ")", "dropAll", "(", "doSave", "bool", ")", "error", "{", "pool", ".", "Lock", "(", ")", "// synchronized", "\n", "defer", "pool", ".", "Unlock", "(", ")", "\n\n", "var", "priorE", "error", "\n", "for", "len", ...
// Remove all our references to readers, and commits any pending changes.
[ "Remove", "all", "our", "references", "to", "readers", "and", "commits", "any", "pending", "changes", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/index/readerPool.go#L42-L94
127,565
balzaczyy/golucene
core/store/ram.go
FileExists
func (rd *RAMDirectory) FileExists(name string) bool { rd.EnsureOpen() rd.fileMapLock.RLock() defer rd.fileMapLock.RUnlock() _, ok := rd.fileMap[name] return ok }
go
func (rd *RAMDirectory) FileExists(name string) bool { rd.EnsureOpen() rd.fileMapLock.RLock() defer rd.fileMapLock.RUnlock() _, ok := rd.fileMap[name] return ok }
[ "func", "(", "rd", "*", "RAMDirectory", ")", "FileExists", "(", "name", "string", ")", "bool", "{", "rd", ".", "EnsureOpen", "(", ")", "\n", "rd", ".", "fileMapLock", ".", "RLock", "(", ")", "\n", "defer", "rd", ".", "fileMapLock", ".", "RUnlock", "(...
// Returns true iff the named file exists in this directory
[ "Returns", "true", "iff", "the", "named", "file", "exists", "in", "this", "directory" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/store/ram.go#L72-L78
127,566
balzaczyy/golucene
core/store/ram.go
OpenInput
func (rd *RAMDirectory) OpenInput(name string, context IOContext) (in IndexInput, err error) { rd.EnsureOpen() if file, ok := rd.fileMap[name]; ok { return newRAMInputStream(name, file) } return nil, errors.New(name) }
go
func (rd *RAMDirectory) OpenInput(name string, context IOContext) (in IndexInput, err error) { rd.EnsureOpen() if file, ok := rd.fileMap[name]; ok { return newRAMInputStream(name, file) } return nil, errors.New(name) }
[ "func", "(", "rd", "*", "RAMDirectory", ")", "OpenInput", "(", "name", "string", ",", "context", "IOContext", ")", "(", "in", "IndexInput", ",", "err", "error", ")", "{", "rd", ".", "EnsureOpen", "(", ")", "\n", "if", "file", ",", "ok", ":=", "rd", ...
// Returns a stream reading an existing file.
[ "Returns", "a", "stream", "reading", "an", "existing", "file", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/store/ram.go#L140-L146
127,567
balzaczyy/golucene
core/store/ram.go
Close
func (rd *RAMDirectory) Close() error { rd.IsOpen = false rd.fileMapLock.Lock() defer rd.fileMapLock.Unlock() rd.fileMap = make(map[string]*RAMFile) return nil }
go
func (rd *RAMDirectory) Close() error { rd.IsOpen = false rd.fileMapLock.Lock() defer rd.fileMapLock.Unlock() rd.fileMap = make(map[string]*RAMFile) return nil }
[ "func", "(", "rd", "*", "RAMDirectory", ")", "Close", "(", ")", "error", "{", "rd", ".", "IsOpen", "=", "false", "\n", "rd", ".", "fileMapLock", ".", "Lock", "(", ")", "\n", "defer", "rd", ".", "fileMapLock", ".", "Unlock", "(", ")", "\n", "rd", ...
// Closes the store to future operations, releasing associated memroy.
[ "Closes", "the", "store", "to", "future", "operations", "releasing", "associated", "memroy", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/store/ram.go#L149-L155
127,568
balzaczyy/golucene
core/index/merge.go
verbose
func (mp *LogMergePolicy) verbose(w *IndexWriter) bool { return w != nil && w.infoStream.IsEnabled("LMP") }
go
func (mp *LogMergePolicy) verbose(w *IndexWriter) bool { return w != nil && w.infoStream.IsEnabled("LMP") }
[ "func", "(", "mp", "*", "LogMergePolicy", ")", "verbose", "(", "w", "*", "IndexWriter", ")", "bool", "{", "return", "w", "!=", "nil", "&&", "w", ".", "infoStream", ".", "IsEnabled", "(", "\"", "\"", ")", "\n", "}" ]
// Returns true if LMP is enabled in IndexWriter's InfoStream.
[ "Returns", "true", "if", "LMP", "is", "enabled", "in", "IndexWriter", "s", "InfoStream", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/index/merge.go#L732-L734
127,569
balzaczyy/golucene
core/index/merge.go
message
func (mp *LogMergePolicy) message(message string, w *IndexWriter) { if mp.verbose(w) { w.infoStream.Message("LMP", message) } }
go
func (mp *LogMergePolicy) message(message string, w *IndexWriter) { if mp.verbose(w) { w.infoStream.Message("LMP", message) } }
[ "func", "(", "mp", "*", "LogMergePolicy", ")", "message", "(", "message", "string", ",", "w", "*", "IndexWriter", ")", "{", "if", "mp", ".", "verbose", "(", "w", ")", "{", "w", ".", "infoStream", ".", "Message", "(", "\"", "\"", ",", "message", ")"...
// Print a debug message to IndexWriter's infoStream.
[ "Print", "a", "debug", "message", "to", "IndexWriter", "s", "infoStream", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/index/merge.go#L737-L741
127,570
balzaczyy/golucene
core/search/explanation.go
addDetail
func (exp *ExplanationImpl) addDetail(detail Explanation) { exp.details = append(exp.details, detail) }
go
func (exp *ExplanationImpl) addDetail(detail Explanation) { exp.details = append(exp.details, detail) }
[ "func", "(", "exp", "*", "ExplanationImpl", ")", "addDetail", "(", "detail", "Explanation", ")", "{", "exp", ".", "details", "=", "append", "(", "exp", ".", "details", ",", "detail", ")", "\n", "}" ]
// Adds a sub-node to this explanation node
[ "Adds", "a", "sub", "-", "node", "to", "this", "explanation", "node" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/search/explanation.go#L54-L56
127,571
balzaczyy/golucene
core/document/fieldType.go
newFieldType
func newFieldType() *FieldType { return &FieldType{ _tokenized: true, _indexOptions: model.INDEX_OPT_DOCS_AND_FREQS_AND_POSITIONS, numericPrecisionStep: util.NUMERIC_PRECISION_STEP_DEFAULT, } }
go
func newFieldType() *FieldType { return &FieldType{ _tokenized: true, _indexOptions: model.INDEX_OPT_DOCS_AND_FREQS_AND_POSITIONS, numericPrecisionStep: util.NUMERIC_PRECISION_STEP_DEFAULT, } }
[ "func", "newFieldType", "(", ")", "*", "FieldType", "{", "return", "&", "FieldType", "{", "_tokenized", ":", "true", ",", "_indexOptions", ":", "model", ".", "INDEX_OPT_DOCS_AND_FREQS_AND_POSITIONS", ",", "numericPrecisionStep", ":", "util", ".", "NUMERIC_PRECISION_...
// Create a new FieldType with default properties.
[ "Create", "a", "new", "FieldType", "with", "default", "properties", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/document/fieldType.go#L58-L64
127,572
balzaczyy/golucene
core/document/fieldType.go
String
func (ft *FieldType) String() string { var buf bytes.Buffer if ft.Stored() { buf.WriteString("stored") } if ft.Indexed() { if buf.Len() > 0 { buf.WriteString(",") } buf.WriteString("indexed") if ft.Tokenized() { buf.WriteString(",tokenized") } if ft.StoreTermVectors() { buf.WriteString(",term...
go
func (ft *FieldType) String() string { var buf bytes.Buffer if ft.Stored() { buf.WriteString("stored") } if ft.Indexed() { if buf.Len() > 0 { buf.WriteString(",") } buf.WriteString("indexed") if ft.Tokenized() { buf.WriteString(",tokenized") } if ft.StoreTermVectors() { buf.WriteString(",term...
[ "func", "(", "ft", "*", "FieldType", ")", "String", "(", ")", "string", "{", "var", "buf", "bytes", ".", "Buffer", "\n", "if", "ft", ".", "Stored", "(", ")", "{", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "ft", "."...
// Prints a Field for human consumption.
[ "Prints", "a", "Field", "for", "human", "consumption", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/document/fieldType.go#L100-L142
127,573
balzaczyy/golucene
core/util/automaton/run.go
charClass
func (ra *RunAutomaton) charClass(c int) int { return findIndex(c, ra.points) }
go
func (ra *RunAutomaton) charClass(c int) int { return findIndex(c, ra.points) }
[ "func", "(", "ra", "*", "RunAutomaton", ")", "charClass", "(", "c", "int", ")", "int", "{", "return", "findIndex", "(", "c", ",", "ra", ".", "points", ")", "\n", "}" ]
// Gets character class of given codepoint
[ "Gets", "character", "class", "of", "given", "codepoint" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/util/automaton/run.go#L26-L28
127,574
balzaczyy/golucene
core/util/automaton/run.go
newRunAutomaton
func newRunAutomaton(a *Automaton, maxInterval int, tablesize bool) *RunAutomaton { a = determinize(a) size := a.numStates() if size < 1 { size = 1 } points := a.startPoints() nPoints := len(points) ans := &RunAutomaton{ maxInterval: maxInterval, automaton: a, points: points, initial: 0, s...
go
func newRunAutomaton(a *Automaton, maxInterval int, tablesize bool) *RunAutomaton { a = determinize(a) size := a.numStates() if size < 1 { size = 1 } points := a.startPoints() nPoints := len(points) ans := &RunAutomaton{ maxInterval: maxInterval, automaton: a, points: points, initial: 0, s...
[ "func", "newRunAutomaton", "(", "a", "*", "Automaton", ",", "maxInterval", "int", ",", "tablesize", "bool", ")", "*", "RunAutomaton", "{", "a", "=", "determinize", "(", "a", ")", "\n", "size", ":=", "a", ".", "numStates", "(", ")", "\n", "if", "size", ...
// Constructs a new RunAutomaton from a deterministic Automaton.
[ "Constructs", "a", "new", "RunAutomaton", "from", "a", "deterministic", "Automaton", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/util/automaton/run.go#L31-L64
127,575
balzaczyy/golucene
core/util/automaton/daciukMihov.go
convert
func convert(a *AutomatonBuilder, s *dfsaState, visited map[*dfsaState]int) int { panic("not implemented yet") }
go
func convert(a *AutomatonBuilder, s *dfsaState, visited map[*dfsaState]int) int { panic("not implemented yet") }
[ "func", "convert", "(", "a", "*", "AutomatonBuilder", ",", "s", "*", "dfsaState", ",", "visited", "map", "[", "*", "dfsaState", "]", "int", ")", "int", "{", "panic", "(", "\"", "\"", ")", "\n", "}" ]
// Internal recursive traversal for conversion.
[ "Internal", "recursive", "traversal", "for", "conversion", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/util/automaton/daciukMihov.go#L32-L34
127,576
balzaczyy/golucene
core/index/config.go
setIndexWriter
func (conf *IndexWriterConfig) setIndexWriter(writer *IndexWriter) *IndexWriterConfig { conf.writer.Set(writer) return conf }
go
func (conf *IndexWriterConfig) setIndexWriter(writer *IndexWriter) *IndexWriterConfig { conf.writer.Set(writer) return conf }
[ "func", "(", "conf", "*", "IndexWriterConfig", ")", "setIndexWriter", "(", "writer", "*", "IndexWriter", ")", "*", "IndexWriterConfig", "{", "conf", ".", "writer", ".", "Set", "(", "writer", ")", "\n", "return", "conf", "\n", "}" ]
// Sets the IndexWriter this config is attached to.
[ "Sets", "the", "IndexWriter", "this", "config", "is", "attached", "to", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/index/config.go#L85-L88
127,577
balzaczyy/golucene
core/codec/blocktree/segmentTermEnumFrame.go
prefixMatches
func (f *segmentTermsEnumFrame) prefixMatches(target []byte) bool { for i := 0; i < f.prefix; i++ { if target[i] != f.ste.term.At(i) { return false } } return true }
go
func (f *segmentTermsEnumFrame) prefixMatches(target []byte) bool { for i := 0; i < f.prefix; i++ { if target[i] != f.ste.term.At(i) { return false } } return true }
[ "func", "(", "f", "*", "segmentTermsEnumFrame", ")", "prefixMatches", "(", "target", "[", "]", "byte", ")", "bool", "{", "for", "i", ":=", "0", ";", "i", "<", "f", ".", "prefix", ";", "i", "++", "{", "if", "target", "[", "i", "]", "!=", "f", "....
// Used only by assert
[ "Used", "only", "by", "assert" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/codec/blocktree/segmentTermEnumFrame.go#L357-L364
127,578
balzaczyy/golucene
core/util/automaton/sortedIntSet.go
incr
func (sis *SortedIntSet) incr(num int) { if sis.useTreeMap { val, ok := sis.dict[num] if !ok { sis.dict[num] = 1 } else { sis.dict[num] = 1 + val } return } for i, v := range sis.values { if v == num { sis.counts[i]++ return } else if num < v { // insert here sis.values = append(sis....
go
func (sis *SortedIntSet) incr(num int) { if sis.useTreeMap { val, ok := sis.dict[num] if !ok { sis.dict[num] = 1 } else { sis.dict[num] = 1 + val } return } for i, v := range sis.values { if v == num { sis.counts[i]++ return } else if num < v { // insert here sis.values = append(sis....
[ "func", "(", "sis", "*", "SortedIntSet", ")", "incr", "(", "num", "int", ")", "{", "if", "sis", ".", "useTreeMap", "{", "val", ",", "ok", ":=", "sis", ".", "dict", "[", "num", "]", "\n", "if", "!", "ok", "{", "sis", ".", "dict", "[", "num", "...
// Adds this state ot the set
[ "Adds", "this", "state", "ot", "the", "set" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/util/automaton/sortedIntSet.go#L40-L73
127,579
balzaczyy/golucene
core/util/automaton/sortedIntSet.go
decr
func (sis *SortedIntSet) decr(num int) { if sis.useTreeMap { count, ok := sis.dict[num] assert(ok) if count == 1 { delete(sis.dict, num) // Fall back to simple arrays once we touch zero again if len(sis.dict) == 0 { sis.useTreeMap = false sis.values = sis.values[:0] // reuse slice sis.counts...
go
func (sis *SortedIntSet) decr(num int) { if sis.useTreeMap { count, ok := sis.dict[num] assert(ok) if count == 1 { delete(sis.dict, num) // Fall back to simple arrays once we touch zero again if len(sis.dict) == 0 { sis.useTreeMap = false sis.values = sis.values[:0] // reuse slice sis.counts...
[ "func", "(", "sis", "*", "SortedIntSet", ")", "decr", "(", "num", "int", ")", "{", "if", "sis", ".", "useTreeMap", "{", "count", ",", "ok", ":=", "sis", ".", "dict", "[", "num", "]", "\n", "assert", "(", "ok", ")", "\n", "if", "count", "==", "1...
// Removes the state from the set, if count decrs to 0
[ "Removes", "the", "state", "from", "the", "set", "if", "count", "decrs", "to", "0" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/util/automaton/sortedIntSet.go#L76-L112
127,580
balzaczyy/golucene
core/util/array.go
newArrayTimSorter
func newArrayTimSorter(arr sort.Interface, maxTempSlots int) *ArrayTimSorter { ans := &ArrayTimSorter{ TimSorter: newTimSorter(arr, maxTempSlots), arr: arr, } if maxTempSlots > 0 { ans.tmp = make([]interface{}, maxTempSlots) } return ans }
go
func newArrayTimSorter(arr sort.Interface, maxTempSlots int) *ArrayTimSorter { ans := &ArrayTimSorter{ TimSorter: newTimSorter(arr, maxTempSlots), arr: arr, } if maxTempSlots > 0 { ans.tmp = make([]interface{}, maxTempSlots) } return ans }
[ "func", "newArrayTimSorter", "(", "arr", "sort", ".", "Interface", ",", "maxTempSlots", "int", ")", "*", "ArrayTimSorter", "{", "ans", ":=", "&", "ArrayTimSorter", "{", "TimSorter", ":", "newTimSorter", "(", "arr", ",", "maxTempSlots", ")", ",", "arr", ":", ...
// Create a new ArrayTimSorter
[ "Create", "a", "new", "ArrayTimSorter" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/util/array.go#L129-L138
127,581
balzaczyy/golucene
core/util/sort.go
newTimSorter
func newTimSorter(arr sort.Interface, maxTempSlots int) *TimSorter { return &TimSorter{ Sorter: newSorter(arr), runEnds: make([]int, 1+STACKSIZE), maxTempSlots: maxTempSlots, } }
go
func newTimSorter(arr sort.Interface, maxTempSlots int) *TimSorter { return &TimSorter{ Sorter: newSorter(arr), runEnds: make([]int, 1+STACKSIZE), maxTempSlots: maxTempSlots, } }
[ "func", "newTimSorter", "(", "arr", "sort", ".", "Interface", ",", "maxTempSlots", "int", ")", "*", "TimSorter", "{", "return", "&", "TimSorter", "{", "Sorter", ":", "newSorter", "(", "arr", ")", ",", "runEnds", ":", "make", "(", "[", "]", "int", ",", ...
// Create a new TimSorter
[ "Create", "a", "new", "TimSorter" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/util/sort.go#L249-L255
127,582
balzaczyy/golucene
core/util/sort.go
minRun
func minRun(length int) int { assert2(length >= MINRUN, fmt.Sprintf("length=%v", length)) n := length r := 0 for n >= 64 { r = (r | (n & 1)) n = int(uint(n) >> 1) } minRun := n + r assert(minRun >= MINRUN && minRun <= RUN_THRESHOLD) return minRun }
go
func minRun(length int) int { assert2(length >= MINRUN, fmt.Sprintf("length=%v", length)) n := length r := 0 for n >= 64 { r = (r | (n & 1)) n = int(uint(n) >> 1) } minRun := n + r assert(minRun >= MINRUN && minRun <= RUN_THRESHOLD) return minRun }
[ "func", "minRun", "(", "length", "int", ")", "int", "{", "assert2", "(", "length", ">=", "MINRUN", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "length", ")", ")", "\n", "n", ":=", "length", "\n", "r", ":=", "0", "\n", "for", "n", ">=", "6...
// Minimum run length for an array of given length.
[ "Minimum", "run", "length", "for", "an", "array", "of", "given", "length", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/util/sort.go#L258-L269
127,583
balzaczyy/golucene
core/util/sort.go
nextRun
func (sorter *TimSorter) nextRun() int { runBase := sorter.runEnd(0) assert2(runBase < sorter.to, fmt.Sprintf("runBase=%v to=%v", runBase, sorter.to)) if runBase == sorter.to-1 { return 1 } o := runBase + 2 if sorter.Less(runBase+1, runBase) { // run must be strictly descending for o < sorter.to && sorter.L...
go
func (sorter *TimSorter) nextRun() int { runBase := sorter.runEnd(0) assert2(runBase < sorter.to, fmt.Sprintf("runBase=%v to=%v", runBase, sorter.to)) if runBase == sorter.to-1 { return 1 } o := runBase + 2 if sorter.Less(runBase+1, runBase) { // run must be strictly descending for o < sorter.to && sorter.L...
[ "func", "(", "sorter", "*", "TimSorter", ")", "nextRun", "(", ")", "int", "{", "runBase", ":=", "sorter", ".", "runEnd", "(", "0", ")", "\n", "assert2", "(", "runBase", "<", "sorter", ".", "to", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "...
// Compute the length of the next run, make the run sorted and return its length
[ "Compute", "the", "length", "of", "the", "next", "run", "make", "the", "run", "sorted", "and", "return", "its", "length" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/util/sort.go#L281-L312
127,584
balzaczyy/golucene
core/index/concurrentMergeScheduler.go
SetMaxMergesAndRoutines
func (cms *ConcurrentMergeScheduler) SetMaxMergesAndRoutines(maxMergeCount, maxRoutineCount int) { assert2(maxRoutineCount >= 1, "maxRoutineCount should be at least 1") assert2(maxMergeCount >= 1, "maxMergeCount should be at least 1") assert2(maxRoutineCount <= maxMergeCount, fmt.Sprintf( "maxRoutineCount should b...
go
func (cms *ConcurrentMergeScheduler) SetMaxMergesAndRoutines(maxMergeCount, maxRoutineCount int) { assert2(maxRoutineCount >= 1, "maxRoutineCount should be at least 1") assert2(maxMergeCount >= 1, "maxMergeCount should be at least 1") assert2(maxRoutineCount <= maxMergeCount, fmt.Sprintf( "maxRoutineCount should b...
[ "func", "(", "cms", "*", "ConcurrentMergeScheduler", ")", "SetMaxMergesAndRoutines", "(", "maxMergeCount", ",", "maxRoutineCount", "int", ")", "{", "assert2", "(", "maxRoutineCount", ">=", "1", ",", "\"", "\"", ")", "\n", "assert2", "(", "maxMergeCount", ">=", ...
// Sets the maximum number of merge goroutines and simultaneous // merges allowed.
[ "Sets", "the", "maximum", "number", "of", "merge", "goroutines", "and", "simultaneous", "merges", "allowed", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/index/concurrentMergeScheduler.go#L135-L150
127,585
balzaczyy/golucene
core/index/segments.go
NewSegmentReader
func NewSegmentReader(si *SegmentCommitInfo, termInfosIndexDivisor int, context store.IOContext) (r *SegmentReader, err error) { r = &SegmentReader{} r.AtomicReaderImpl = newAtomicReader(r) r.ARFieldsReader = r r.si = si if r.fieldInfos, err = ReadFieldInfos(si); err != nil { return nil, err } // log.Print(...
go
func NewSegmentReader(si *SegmentCommitInfo, termInfosIndexDivisor int, context store.IOContext) (r *SegmentReader, err error) { r = &SegmentReader{} r.AtomicReaderImpl = newAtomicReader(r) r.ARFieldsReader = r r.si = si if r.fieldInfos, err = ReadFieldInfos(si); err != nil { return nil, err } // log.Print(...
[ "func", "NewSegmentReader", "(", "si", "*", "SegmentCommitInfo", ",", "termInfosIndexDivisor", "int", ",", "context", "store", ".", "IOContext", ")", "(", "r", "*", "SegmentReader", ",", "err", "error", ")", "{", "r", "=", "&", "SegmentReader", "{", "}", "...
/** * Constructs a new SegmentReader with a new core. * @throws CorruptIndexException if the index is corrupt * @throws IOException if there is a low-level IO error */ // TODO: why is this public?
[ "Constructs", "a", "new", "SegmentReader", "with", "a", "new", "core", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/index/segments.go#L45-L88
127,586
balzaczyy/golucene
core/index/segments.go
String
func (r *SegmentReader) String() string { // SegmentInfo.toString takes dir and number of // *pending* deletions; so we reverse compute that here: return r.si.StringOf(r.si.Info.Dir, r.si.Info.DocCount()-r.numDocs-r.si.DelCount()) }
go
func (r *SegmentReader) String() string { // SegmentInfo.toString takes dir and number of // *pending* deletions; so we reverse compute that here: return r.si.StringOf(r.si.Info.Dir, r.si.Info.DocCount()-r.numDocs-r.si.DelCount()) }
[ "func", "(", "r", "*", "SegmentReader", ")", "String", "(", ")", "string", "{", "// SegmentInfo.toString takes dir and number of", "// *pending* deletions; so we reverse compute that here:", "return", "r", ".", "si", ".", "StringOf", "(", "r", ".", "si", ".", "Info", ...
// SegmentReader.java L179
[ "SegmentReader", ".", "java", "L179" ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/index/segments.go#L198-L202
127,587
balzaczyy/golucene
core/store/fs.go
DeleteFile
func (d *FSDirectory) DeleteFile(name string) (err error) { d.EnsureOpen() if err = os.Remove(filepath.Join(d.path, name)); err == nil { d.staleFilesLock.Lock() defer d.staleFilesLock.Unlock() delete(d.staleFiles, name) } return }
go
func (d *FSDirectory) DeleteFile(name string) (err error) { d.EnsureOpen() if err = os.Remove(filepath.Join(d.path, name)); err == nil { d.staleFilesLock.Lock() defer d.staleFilesLock.Unlock() delete(d.staleFiles, name) } return }
[ "func", "(", "d", "*", "FSDirectory", ")", "DeleteFile", "(", "name", "string", ")", "(", "err", "error", ")", "{", "d", ".", "EnsureOpen", "(", ")", "\n", "if", "err", "=", "os", ".", "Remove", "(", "filepath", ".", "Join", "(", "d", ".", "path"...
// Removes an existing file in the directory.
[ "Removes", "an", "existing", "file", "in", "the", "directory", "." ]
d0be9ee89713717392b5b089e18a5a6fb6a63562
https://github.com/balzaczyy/golucene/blob/d0be9ee89713717392b5b089e18a5a6fb6a63562/core/store/fs.go#L129-L137
127,588
kr/fs
walk.go
WalkFS
func WalkFS(root string, fs FileSystem) *Walker { info, err := fs.Lstat(root) return &Walker{ fs: fs, stack: []item{{root, info, err}}, } }
go
func WalkFS(root string, fs FileSystem) *Walker { info, err := fs.Lstat(root) return &Walker{ fs: fs, stack: []item{{root, info, err}}, } }
[ "func", "WalkFS", "(", "root", "string", ",", "fs", "FileSystem", ")", "*", "Walker", "{", "info", ",", "err", ":=", "fs", ".", "Lstat", "(", "root", ")", "\n", "return", "&", "Walker", "{", "fs", ":", "fs", ",", "stack", ":", "[", "]", "item", ...
// WalkFS returns a new Walker rooted at root on the FileSystem fs.
[ "WalkFS", "returns", "a", "new", "Walker", "rooted", "at", "root", "on", "the", "FileSystem", "fs", "." ]
1455def202f6e05b95cc7bfc7e8ae67ae5141eba
https://github.com/kr/fs/blob/1455def202f6e05b95cc7bfc7e8ae67ae5141eba/walk.go#L34-L40
127,589
kr/fs
walk.go
Step
func (w *Walker) Step() bool { if w.descend && w.cur.err == nil && w.cur.info.IsDir() { list, err := w.fs.ReadDir(w.cur.path) if err != nil { w.cur.err = err w.stack = append(w.stack, w.cur) } else { for i := len(list) - 1; i >= 0; i-- { path := w.fs.Join(w.cur.path, list[i].Name()) w.stack = ap...
go
func (w *Walker) Step() bool { if w.descend && w.cur.err == nil && w.cur.info.IsDir() { list, err := w.fs.ReadDir(w.cur.path) if err != nil { w.cur.err = err w.stack = append(w.stack, w.cur) } else { for i := len(list) - 1; i >= 0; i-- { path := w.fs.Join(w.cur.path, list[i].Name()) w.stack = ap...
[ "func", "(", "w", "*", "Walker", ")", "Step", "(", ")", "bool", "{", "if", "w", ".", "descend", "&&", "w", ".", "cur", ".", "err", "==", "nil", "&&", "w", ".", "cur", ".", "info", ".", "IsDir", "(", ")", "{", "list", ",", "err", ":=", "w", ...
// Step advances the Walker to the next file or directory, // which will then be available through the Path, Stat, // and Err methods. // It returns false when the walk stops at the end of the tree.
[ "Step", "advances", "the", "Walker", "to", "the", "next", "file", "or", "directory", "which", "will", "then", "be", "available", "through", "the", "Path", "Stat", "and", "Err", "methods", ".", "It", "returns", "false", "when", "the", "walk", "stops", "at",...
1455def202f6e05b95cc7bfc7e8ae67ae5141eba
https://github.com/kr/fs/blob/1455def202f6e05b95cc7bfc7e8ae67ae5141eba/walk.go#L46-L68
127,590
dotabuff/manta
entity.go
newEntity
func newEntity(index, serial int32, class *class) *Entity { return &Entity{ index: index, serial: serial, class: class, active: true, state: newFieldState(), fpCache: make(map[string]*fieldPath), fpNoop: make(map[string]bool), } }
go
func newEntity(index, serial int32, class *class) *Entity { return &Entity{ index: index, serial: serial, class: class, active: true, state: newFieldState(), fpCache: make(map[string]*fieldPath), fpNoop: make(map[string]bool), } }
[ "func", "newEntity", "(", "index", ",", "serial", "int32", ",", "class", "*", "class", ")", "*", "Entity", "{", "return", "&", "Entity", "{", "index", ":", "index", ",", "serial", ":", "serial", ",", "class", ":", "class", ",", "active", ":", "true",...
// newEntity returns a new entity for the given index, serial and class
[ "newEntity", "returns", "a", "new", "entity", "for", "the", "given", "index", "serial", "and", "class" ]
f51563b05e0e19c9ac19196e26455af1782ed3f0
https://github.com/dotabuff/manta/blob/f51563b05e0e19c9ac19196e26455af1782ed3f0/entity.go#L62-L72
127,591
dotabuff/manta
entity.go
String
func (e *Entity) String() string { return fmt.Sprintf("%d <%s>", e.index, e.class.name) }
go
func (e *Entity) String() string { return fmt.Sprintf("%d <%s>", e.index, e.class.name) }
[ "func", "(", "e", "*", "Entity", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "e", ".", "index", ",", "e", ".", "class", ".", "name", ")", "\n", "}" ]
// String returns a human identifiable string for the Entity
[ "String", "returns", "a", "human", "identifiable", "string", "for", "the", "Entity" ]
f51563b05e0e19c9ac19196e26455af1782ed3f0
https://github.com/dotabuff/manta/blob/f51563b05e0e19c9ac19196e26455af1782ed3f0/entity.go#L75-L77
127,592
dotabuff/manta
entity.go
Map
func (e *Entity) Map() map[string]interface{} { values := make(map[string]interface{}) for _, fp := range e.class.getFieldPaths(newFieldPath(), e.state) { values[e.class.getNameForFieldPath(fp)] = e.state.get(fp) } return values }
go
func (e *Entity) Map() map[string]interface{} { values := make(map[string]interface{}) for _, fp := range e.class.getFieldPaths(newFieldPath(), e.state) { values[e.class.getNameForFieldPath(fp)] = e.state.get(fp) } return values }
[ "func", "(", "e", "*", "Entity", ")", "Map", "(", ")", "map", "[", "string", "]", "interface", "{", "}", "{", "values", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "for", "_", ",", "fp", ":=", "range", "e", ...
// Map returns a map of current entity state as key-value pairs
[ "Map", "returns", "a", "map", "of", "current", "entity", "state", "as", "key", "-", "value", "pairs" ]
f51563b05e0e19c9ac19196e26455af1782ed3f0
https://github.com/dotabuff/manta/blob/f51563b05e0e19c9ac19196e26455af1782ed3f0/entity.go#L80-L86
127,593
dotabuff/manta
entity.go
Get
func (e *Entity) Get(name string) interface{} { if fp, ok := e.fpCache[name]; ok { return e.state.get(fp) } if e.fpNoop[name] { return nil } fp := newFieldPath() if !e.class.getFieldPathForName(fp, name) { e.fpNoop[name] = true fp.release() return nil } e.fpCache[name] = fp return e.state.get(fp) }
go
func (e *Entity) Get(name string) interface{} { if fp, ok := e.fpCache[name]; ok { return e.state.get(fp) } if e.fpNoop[name] { return nil } fp := newFieldPath() if !e.class.getFieldPathForName(fp, name) { e.fpNoop[name] = true fp.release() return nil } e.fpCache[name] = fp return e.state.get(fp) }
[ "func", "(", "e", "*", "Entity", ")", "Get", "(", "name", "string", ")", "interface", "{", "}", "{", "if", "fp", ",", "ok", ":=", "e", ".", "fpCache", "[", "name", "]", ";", "ok", "{", "return", "e", ".", "state", ".", "get", "(", "fp", ")", ...
// Get returns the current value of the Entity state for the given key
[ "Get", "returns", "the", "current", "value", "of", "the", "Entity", "state", "for", "the", "given", "key" ]
f51563b05e0e19c9ac19196e26455af1782ed3f0
https://github.com/dotabuff/manta/blob/f51563b05e0e19c9ac19196e26455af1782ed3f0/entity.go#L94-L111
127,594
dotabuff/manta
entity.go
Exists
func (e *Entity) Exists(name string) bool { return e.Get(name) != nil }
go
func (e *Entity) Exists(name string) bool { return e.Get(name) != nil }
[ "func", "(", "e", "*", "Entity", ")", "Exists", "(", "name", "string", ")", "bool", "{", "return", "e", ".", "Get", "(", "name", ")", "!=", "nil", "\n", "}" ]
// Exists returns true if the given key exists in the Entity state
[ "Exists", "returns", "true", "if", "the", "given", "key", "exists", "in", "the", "Entity", "state" ]
f51563b05e0e19c9ac19196e26455af1782ed3f0
https://github.com/dotabuff/manta/blob/f51563b05e0e19c9ac19196e26455af1782ed3f0/entity.go#L114-L116
127,595
dotabuff/manta
entity.go
GetInt32
func (e *Entity) GetInt32(name string) (int32, bool) { x, ok := e.Get(name).(int32) return x, ok }
go
func (e *Entity) GetInt32(name string) (int32, bool) { x, ok := e.Get(name).(int32) return x, ok }
[ "func", "(", "e", "*", "Entity", ")", "GetInt32", "(", "name", "string", ")", "(", "int32", ",", "bool", ")", "{", "x", ",", "ok", ":=", "e", ".", "Get", "(", "name", ")", ".", "(", "int32", ")", "\n", "return", "x", ",", "ok", "\n", "}" ]
// GetInt32 gets given key as an int32
[ "GetInt32", "gets", "given", "key", "as", "an", "int32" ]
f51563b05e0e19c9ac19196e26455af1782ed3f0
https://github.com/dotabuff/manta/blob/f51563b05e0e19c9ac19196e26455af1782ed3f0/entity.go#L119-L122
127,596
dotabuff/manta
entity.go
GetUint32
func (e *Entity) GetUint32(name string) (uint32, bool) { if v := e.Get(name); v != nil { switch x := v.(type) { case uint32: return x, true case uint64: return uint32(x), true } } return 0, false }
go
func (e *Entity) GetUint32(name string) (uint32, bool) { if v := e.Get(name); v != nil { switch x := v.(type) { case uint32: return x, true case uint64: return uint32(x), true } } return 0, false }
[ "func", "(", "e", "*", "Entity", ")", "GetUint32", "(", "name", "string", ")", "(", "uint32", ",", "bool", ")", "{", "if", "v", ":=", "e", ".", "Get", "(", "name", ")", ";", "v", "!=", "nil", "{", "switch", "x", ":=", "v", ".", "(", "type", ...
// GetUint32 gets given key as a uint32
[ "GetUint32", "gets", "given", "key", "as", "a", "uint32" ]
f51563b05e0e19c9ac19196e26455af1782ed3f0
https://github.com/dotabuff/manta/blob/f51563b05e0e19c9ac19196e26455af1782ed3f0/entity.go#L125-L135
127,597
dotabuff/manta
entity.go
GetUint64
func (e *Entity) GetUint64(name string) (uint64, bool) { x, ok := e.Get(name).(uint64) return x, ok }
go
func (e *Entity) GetUint64(name string) (uint64, bool) { x, ok := e.Get(name).(uint64) return x, ok }
[ "func", "(", "e", "*", "Entity", ")", "GetUint64", "(", "name", "string", ")", "(", "uint64", ",", "bool", ")", "{", "x", ",", "ok", ":=", "e", ".", "Get", "(", "name", ")", ".", "(", "uint64", ")", "\n", "return", "x", ",", "ok", "\n", "}" ]
// GetUint64 gets given key as a uint64
[ "GetUint64", "gets", "given", "key", "as", "a", "uint64" ]
f51563b05e0e19c9ac19196e26455af1782ed3f0
https://github.com/dotabuff/manta/blob/f51563b05e0e19c9ac19196e26455af1782ed3f0/entity.go#L138-L141
127,598
dotabuff/manta
entity.go
GetFloat32
func (e *Entity) GetFloat32(name string) (float32, bool) { x, ok := e.Get(name).(float32) return x, ok }
go
func (e *Entity) GetFloat32(name string) (float32, bool) { x, ok := e.Get(name).(float32) return x, ok }
[ "func", "(", "e", "*", "Entity", ")", "GetFloat32", "(", "name", "string", ")", "(", "float32", ",", "bool", ")", "{", "x", ",", "ok", ":=", "e", ".", "Get", "(", "name", ")", ".", "(", "float32", ")", "\n", "return", "x", ",", "ok", "\n", "}...
// GetFloat32 gets given key as an float32
[ "GetFloat32", "gets", "given", "key", "as", "an", "float32" ]
f51563b05e0e19c9ac19196e26455af1782ed3f0
https://github.com/dotabuff/manta/blob/f51563b05e0e19c9ac19196e26455af1782ed3f0/entity.go#L144-L147
127,599
dotabuff/manta
entity.go
GetString
func (e *Entity) GetString(name string) (string, bool) { x, ok := e.Get(name).(string) return x, ok }
go
func (e *Entity) GetString(name string) (string, bool) { x, ok := e.Get(name).(string) return x, ok }
[ "func", "(", "e", "*", "Entity", ")", "GetString", "(", "name", "string", ")", "(", "string", ",", "bool", ")", "{", "x", ",", "ok", ":=", "e", ".", "Get", "(", "name", ")", ".", "(", "string", ")", "\n", "return", "x", ",", "ok", "\n", "}" ]
// GetString gets given key as a string
[ "GetString", "gets", "given", "key", "as", "a", "string" ]
f51563b05e0e19c9ac19196e26455af1782ed3f0
https://github.com/dotabuff/manta/blob/f51563b05e0e19c9ac19196e26455af1782ed3f0/entity.go#L150-L153