java
java copied to clipboard
NameScope interacts poorly with subscoping
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Yes
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04 x86_64): macOS x86_64
- TensorFlow installed from (source or binary): source
- TensorFlow version (use command below): 0.5.0-SNAPSHOT
- Java version (i.e., the output of
java -version): JDK 11
Describe the current behavior
I'm trying to debug test failures in tensorflow-framework, and noticed that the test sessions use tf = Ops.create(graph).withName("test");. This makes all the nodes have the name "test_tf = Ops.create(graph).withSubScope("test");, but now I'm getting test failures out of the optimizers with the following message:
[INFO] Running org.tensorflow.framework.optimizers.FtrlTest
[ERROR] Tests run: 5, Failures: 0, Errors: 4, Skipped: 0, Time elapsed: 0.455 s <<< FAILURE! - in org.tensorflow.framework.optimizers.FtrlTest
[ERROR] testFtrlWithL1 Time elapsed: 0.415 s <<< ERROR!
java.lang.IllegalArgumentException: invalid name: 'test/var0_gradient_accumulator' does not match the regular expression [A-Za-z0-9.][A-Za-z0-9_.\-]*
at org.tensorflow.framework.optimizers.FtrlTest.testFtrlWithL1(FtrlTest.java:166)
Describe the expected behavior
No test failures, and test nodes have the correct op names.
Code to reproduce the issue
Make the withSubScope change at line 44 in org.tensorflow.framework.utils.GraphTestSession.
Here's another issue related to name scoping, are they related? https://github.com/tensorflow/java/issues/397
I think #397 was fixed by the name import logic that was added in one of @rnett's PRs.