MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / NewContext

Function NewContext

tensorflow/go/context.go:79–94  ·  view source on GitHub ↗

NewContext creates a new context for eager execution. options may be nil to use the default options.

(options *ContextOptions)

Source from the content-addressed store, hash-verified

77// NewContext creates a new context for eager execution.
78// options may be nil to use the default options.
79func NewContext(options *ContextOptions) (*Context, error) {
80 status := newStatus()
81 cOpt, err := options.c()
82 if err != nil {
83 return nil, err
84 }
85 defer C.TFE_DeleteContextOptions(cOpt)
86 cContext := C.TFE_NewContext(cOpt, status.c)
87 if err := status.Err(); err != nil {
88 return nil, err
89 }
90
91 c := &Context{c: cContext}
92 runtime.SetFinalizer(c, (*Context).finalizer)
93 return c, nil
94}
95
96func (c *Context) finalizer() {
97 C.TFE_DeleteContext(c.c)

Callers 2

Calls 3

newStatusFunction · 0.85
cMethod · 0.45
ErrMethod · 0.45

Tested by 2