Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextPool ¶
type ContextPool struct {
// Pool of context objects
*Pool
// contains filtered or unexported fields
}
ContextPool is a pool of context objects
func NewContextPool ¶
func NewContextPool(path string, max int, gpu int) *ContextPool
Create a new context pool of context objects, up to 'max' items Set the path for the model storage If GPU is -1 then disable, if 0 then use default, if >0 then enable and use the specified device
func (*ContextPool) Close ¶
func (m *ContextPool) Close() error
Close the pool and release all resources
func (*ContextPool) Drain ¶
func (m *ContextPool) Drain(model *schema.Model) error
Drain the pool of all contexts for a model, freeing resources
func (*ContextPool) MarshalJSON ¶
func (m *ContextPool) MarshalJSON() ([]byte, error)
func (*ContextPool) Put ¶
func (m *ContextPool) Put(ctx *task.Context)
Put a context back into the pool
func (*ContextPool) String ¶
func (m *ContextPool) String() string
type Pool ¶
Pool is a pool of context objects, up to a maximum number This acts as a cache so we don't need to reload models If the pool is full, then Get will return nil
Click to show internal directories.
Click to hide internal directories.