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

Function NewTensorHandle

tensorflow/go/tensor_handle.go:46–56  ·  view source on GitHub ↗

NewTensorHandle creates a new tensor handle from a tensor.

(t *Tensor)

Source from the content-addressed store, hash-verified

44
45// NewTensorHandle creates a new tensor handle from a tensor.
46func NewTensorHandle(t *Tensor) (*TensorHandle, error) {
47 status := newStatus()
48 cHandle := C.TFE_NewTensorHandle(t.c, status.c)
49 if err := status.Err(); err != nil {
50 return nil, err
51 }
52
53 th := &TensorHandle{c: cHandle}
54 runtime.SetFinalizer(th, (*TensorHandle).finalizer)
55 return th, nil
56}
57
58func (th *TensorHandle) finalizer() {
59 C.TFE_DeleteTensorHandle(th.c)

Callers 6

TestNewTensorHandleFunction · 0.85
TestTensorHandleDataTypeFunction · 0.85
TestTensorHandleShapeFunction · 0.85
TestTensorHandleToTensorFunction · 0.85

Calls 2

newStatusFunction · 0.85
ErrMethod · 0.45

Tested by 6

TestNewTensorHandleFunction · 0.68
TestTensorHandleDataTypeFunction · 0.68
TestTensorHandleShapeFunction · 0.68
TestTensorHandleToTensorFunction · 0.68