@@ -404,7 +404,7 @@ public GraphOperationBuilder opBuilder(String type, String name, Scope scope) {
404404 * immediately without re-registering it.
405405 *
406406 * <p>The function is also stored in an internal cache to speed up subsequent lookups performed by
407- * {@link #getFunction(String)} and {@link #getFunctionCached(String)} .
407+ * {@link #getFunction(String)}.
408408 */
409409 @ Override
410410 public void attachFunction (ConcreteFunction function ) {
@@ -915,26 +915,15 @@ Set<Operation> initializers() {
915915 new ConcurrentHashMap <>();
916916
917917 /**
918- * Returns a cached {@link ConcreteFunction} whose name starts with the provided prefix .
918+ * Returns a read-only view of the function names cached by this graph .
919919 *
920- * <p>This is a lightweight lookup helper used when the exact function name is not known but
921- * follows a deterministic prefix (for example functions generated for control-flow constructs or
922- * custom gradient expansions).
920+ * <p>This exposes only the function names so callers can resolve ambiguous matches themselves
921+ * before calling {@link #getFunction(String)} with an exact name.
923922 *
924- * <p>The search is performed only in the local cache and does not query the native TensorFlow
925- * function library.
926- *
927- * @param prefix function name prefix
928- * @return a cached {@link ConcreteFunction} whose name starts with {@code prefix}, or {@code
929- * null} if none is found
923+ * @return a read-only view of cached function names
930924 */
931- public ConcreteFunction getFunctionCached (String prefix ) {
932- for (Map .Entry <String , ConcreteFunction > e : functionCache .entrySet ()) {
933- if (e .getKey ().startsWith (prefix )) {
934- return e .getValue ();
935- }
936- }
937- return null ;
925+ public Set <String > functionNames () {
926+ return Collections .unmodifiableSet (functionCache .keySet ());
938927 }
939928
940929 /**
0 commit comments