ggml-backend: Close on nil should be a no-op

This commit is contained in:
Jesse Gross 2025-02-10 10:36:00 -08:00 committed by Jesse Gross
parent 60830695c2
commit d223f3b697

View File

@ -327,9 +327,11 @@ func (c Context) FromIntSlice(s []int32, shape ...int) (ml.Tensor, error) {
} }
func (c *Context) Close() { func (c *Context) Close() {
if c != nil {
C.ggml_backend_sched_free(c.sched) C.ggml_backend_sched_free(c.sched)
C.ggml_free(c.ctx) C.ggml_free(c.ctx)
} }
}
type Tensor struct { type Tensor struct {
t *C.struct_ggml_tensor t *C.struct_ggml_tensor