Cache the tf_output object in every tensor lazily on the first call to
_.as_tf_output(). This achieves the extra benefit that while converting the feed_dict of (tensor, value) to dict(tensor as tf output, value) - earlier we would be adding newly created objects to the dictionary every time; thereby creating a random order of feed inputs even when the feed_dict from the client doesn't change. In turn, this causes a blowup in the number of keys cached by the C++ Executor. By caching the object, we will end up with a deterministic (yet unsorted) order while iterating the python dictionary of tf output objects. As an additional safeguard; we should also consider removing the support of adding unsorted cache keys to the executors_ in C++ and recommend clients to use the MakeCallable API (available via make_callable_from_options in python) if they don't want to have the sorting overhead of cache keys in GetOrCreateExecutors(). PiperOrigin-RevId: 218784988
Loading
Please sign in to comment