MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / init

Function init

external/ggml/examples/python/ggml/utils.py:8–16  ·  view source on GitHub ↗

Initialize a ggml context, which will be freed automatically when the pointer is garbage collected.

(mem_size: int, mem_buffer: ffi.CData = ffi.NULL, no_alloc: bool = False)

Source from the content-addressed store, hash-verified

6import numpy as np
7
8def init(mem_size: int, mem_buffer: ffi.CData = ffi.NULL, no_alloc: bool = False) -> ffi.CData:
9 """
10 Initialize a ggml context, which will be freed automatically when the pointer is garbage collected.
11 """
12 params = ffi.new('struct ggml_init_params*')
13 params.mem_size = mem_size
14 params.mem_buffer = mem_buffer
15 params.no_alloc = no_alloc
16 return ffi.gc(lib.ggml_init(params[0]), lib.ggml_free)
17
18TensorLike = Union[ffi.CData, np.ndarray]
19

Callers 6

ctxFunction · 0.90
initMethod · 0.85
get_ptrMethod · 0.85
device_memoryClass · 0.85

Calls

no outgoing calls

Tested by 1

ctxFunction · 0.72