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
Loading
Please sign in to comment