Example #1
0
 def testGetThrowsExceptionWithChildrenButNoMatch(self):
   var_name = 'parent/child'
   with self.test_session():
     with tf.variable_scope(var_name):
       variables.variable('grandchild1', [7])
       variables.variable('grandchild2', [9])
     with self.assertRaises(ValueError):
       variables.get_unique_variable(var_name)
Example #2
0
 def testGetThrowsExceptionWithChildrenButNoMatch(self):
     var_name = 'parent/child'
     with self.test_session():
         with tf.variable_scope(var_name):
             variables.variable('grandchild1', [7])
             variables.variable('grandchild2', [9])
         with self.assertRaises(ValueError):
             variables.get_unique_variable(var_name)
Example #3
0
 def testGetVariableWithDistractors(self):
     with self.test_session():
         with tf.variable_scope('parent'):
             a = variables.variable('child', [5])
             with tf.variable_scope('child'):
                 variables.variable('grandchild1', [7])
                 variables.variable('grandchild2', [9])
         self.assertEquals(a, variables.get_unique_variable('parent/child'))
Example #4
0
 def testGetVariableWithDistractors(self):
   with self.test_session():
     with tf.variable_scope('parent'):
       a = variables.variable('child', [5])
       with tf.variable_scope('child'):
         variables.variable('grandchild1', [7])
         variables.variable('grandchild2', [9])
     self.assertEquals(a, variables.get_unique_variable('parent/child'))
Example #5
0
 def testGetVariableWithDistractors(self):
     with self.test_session():
         with tf.variable_scope("parent"):
             a = variables.variable("child", [5])
             with tf.variable_scope("child"):
                 variables.variable("grandchild1", [7])
                 variables.variable("grandchild2", [9])
         self.assertEquals(a, variables.get_unique_variable("parent/child"))
Example #6
0
 def testGetVariableThrowsExceptionWithNoMatch(self):
     var_name = 'cant_find_me'
     with self.test_session():
         with self.assertRaises(ValueError):
             variables.get_unique_variable(var_name)
Example #7
0
 def testGetVariableWithSingleVar(self):
     with self.test_session():
         with tf.variable_scope('parent'):
             a = variables.variable('child', [5])
         self.assertEquals(a, variables.get_unique_variable('parent/child'))
Example #8
0
 def testGetVariableThrowsExceptionWithNoMatch(self):
   var_name = 'cant_find_me'
   with self.test_session():
     with self.assertRaises(ValueError):
       variables.get_unique_variable(var_name)
Example #9
0
 def testGetVariableWithSingleVar(self):
   with self.test_session():
     with tf.variable_scope('parent'):
       a = variables.variable('child', [5])
     self.assertEquals(a, variables.get_unique_variable('parent/child'))