Skip to content

Commit

Permalink
backend: Don't return an error on Close
Browse files Browse the repository at this point in the history
It is not common to return errors with close/free operations - most
people won't check it and even if they did there's probably not much
that can do. It's better to not give implementations false expectations.
  • Loading branch information
jessegross committed Feb 14, 2025
1 parent 5824541 commit 7e13f56
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ml/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type Context interface {

Forward(Tensor)
Compute(Tensor) Tensor
Close() error
Close()
}

type Tensor interface {
Expand Down
3 changes: 1 addition & 2 deletions ml/backend/ggml/ggml.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,9 @@ func (c Context) FromIntSlice(s []int32, shape ...int) (ml.Tensor, error) {
return fromSlice(c, s, shape, C.GGML_TYPE_I32)
}

func (c *Context) Close() error {
func (c *Context) Close() {
C.ggml_backend_sched_free(c.sched)
C.ggml_free(c.ctx)
return nil
}

type Tensor struct {
Expand Down

0 comments on commit 7e13f56

Please sign in to comment.