Commit fa8b0ef3 authored by Nick Felt's avatar Nick Felt Committed by TensorFlower Gardener
Browse files

Store SummaryWriter in thread context, not just its resource

This changes the eager context to maintain a reference to the entire SummaryWriter object (for the TF 1.x contrib and TF 2.0 summary APIs), not just the underlying resource tensor.

Fixes #25976 where under eager mode, calling the set_as_default() method only worked if a separate reference to the writer was manually maintained for as long as the writer remains the default, since as soon as there are no references the underlying resource is destroyed and attempts to use the summary API fail with a resource-not-found error. This bug was easy to hit via the shortcut chained call `create_file_writer(logdir).set_as_default()` which essentially never worked.

PiperOrigin-RevId: 235939473
parent e19750ee
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment