Fix: Go GC could destroy input tensors while SessionRun() was still running, see https://github.com/tensorflow/tensorflow/issues/13129
This commit is contained in:
parent
03619fab3f
commit
846454faae
@ -89,6 +89,10 @@ func (s *Session) Run(feeds map[Output]*Tensor, fetches []Output, targets []*Ope
|
||||
ptrOutput(c.fetches), ptrTensor(c.fetchTensors), C.int(len(fetches)),
|
||||
ptrOperation(c.targets), C.int(len(targets)),
|
||||
nil, status.c)
|
||||
|
||||
// Make sure GC won't harvest input tensors until SessionRun() is finished
|
||||
runtime.KeepAlive(feeds)
|
||||
|
||||
if err := status.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user