Skip to content

Cache graph functions and add If gradient test#637

Open
nfeybesse wants to merge 1 commit intotensorflow:masterfrom
nfeybesse:custom/graph-function-cache
Open

Cache graph functions and add If gradient test#637
nfeybesse wants to merge 1 commit intotensorflow:masterfrom
nfeybesse:custom/graph-function-cache

Conversation

@nfeybesse
Copy link
Contributor

This PR introduces a small cache of ConcreteFunction instances attached to a Graph.

When functions are attached via attachFunction, they are stored in a local cache
indexed by their defined name. This avoids repeatedly scanning the native
TensorFlow function library when resolving functions during gradient construction.

A helper method getFunctionCached(String prefix) is also added to allow quick lookup
of cached functions by name prefix.

In addition, this PR introduces IfGradientTest, a unit test validating correct
gradient propagation through a StatefulIf operation.

@nfeybesse nfeybesse force-pushed the custom/graph-function-cache branch from 846b6cf to 16b27d2 Compare March 12, 2026 13:17
@Craigacp
Copy link
Collaborator

We've removed Windows support in preparation for the 1.2 release, please don't add it back to the CI. Google don't release the libtensorflow binaries on Windows which we've used for the past few releases, and building libtensorflow from source isn't tenable with the GitHub Actions resources we have access to.

@nfeybesse nfeybesse force-pushed the custom/graph-function-cache branch from 16b27d2 to 9c3b19d Compare March 12, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants