File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -320,6 +320,9 @@ impl Session {
320320 }
321321 }
322322
323+ // In case we're running it a second time and not all outputs were taken out.
324+ step. drop_output_tensors ( ) ;
325+
323326 let status = Status :: new ( ) ;
324327 unsafe {
325328 tf:: TF_Run (
@@ -458,10 +461,8 @@ impl<'l> Step<'l> {
458461 Some ( DataType :: from_int ( mem:: transmute ( tf:: TF_TensorType ( self . output_tensors [ output_idx] ) ) ) )
459462 }
460463 }
461- }
462464
463- impl < ' l > Drop for Step < ' l > {
464- fn drop ( & mut self ) {
465+ fn drop_output_tensors ( & mut self ) {
465466 for & tensor in & self . output_tensors {
466467 // TODO: Is TF_DeleteTensor NULL safe?
467468 if !tensor. is_null ( ) {
@@ -473,6 +474,12 @@ impl<'l> Drop for Step<'l> {
473474 }
474475}
475476
477+ impl < ' l > Drop for Step < ' l > {
478+ fn drop ( & mut self ) {
479+ self . drop_output_tensors ( ) ;
480+ }
481+ }
482+
476483////////////////////////
477484
478485/// Convenience type for `Result` with `Status` as the error type.
You can’t perform that action at this time.
0 commit comments