(self)
| 853 | |
| 854 | @test_util.run_v1_only("b/120545219") |
| 855 | def testBasic(self): |
| 856 | gamma = resource_variable_ops.ResourceVariable( |
| 857 | np.random.random((3,)), |
| 858 | dtype="float32", name="gamma") |
| 859 | |
| 860 | inputs = array_ops.ones(shape=(3,), dtype="float32") |
| 861 | |
| 862 | def TestFn(): |
| 863 | output = inputs + gamma |
| 864 | return output |
| 865 | |
| 866 | training = array_ops.placeholder_with_default(True, shape=()) |
| 867 | output = control_flow_ops.cond( |
| 868 | training, TestFn, lambda: inputs) |
| 869 | |
| 870 | loss = output |
| 871 | |
| 872 | grads = gradients.gradients( |
| 873 | loss, [gamma]) |
| 874 | self.assertTrue(None not in grads) |
| 875 | |
| 876 | |
| 877 | class GetDependentVariablesTest(test_util.TensorFlowTestCase): |
nothing calls this directly
no test coverage detected