Exemplo n.º 1
0
 def testFormatVariableMap(self):
     with tf.variable_scope("m1"):
         v1 = tf.get_variable("v1", shape=[3, 4])
     with tf.device("/gpu"):
         with tf.variable_scope("m2"):
             v2 = tf.get_local_variable("v2", shape=[5, 6])
     var_map = {"vv1": v1, "vv2": v2}
     self.assertEqual(snt.format_variable_map(var_map),
                      _EXPECTED_FORMATTED_VARIABLE_MAP)
Exemplo n.º 2
0
 def testFormatVariableMap(self):
   with tf.variable_scope("m1"):
     v1 = tf.get_variable("v1", shape=[3, 4])
   with tf.device("/gpu"):
     with tf.variable_scope("m2"):
       v2 = tf.get_local_variable("v2", shape=[5, 6])
   var_map = {"vv1": v1, "vv2": v2}
   self.assertEqual(snt.format_variable_map(var_map),
                    _EXPECTED_FORMATTED_VARIABLE_MAP)
Exemplo n.º 3
0
 def testFormatVariableMap(self, use_resource, expected):
   with tf.variable_scope("m1"):
     v1 = tf.get_variable("v1", shape=[3, 4], use_resource=use_resource)
   with tf.device("/gpu"):
     with tf.variable_scope("m2"):
       v2 = tf.get_local_variable(
           "v2", shape=[5, 6], use_resource=use_resource)
   var_map = {"vv1": v1, "vv2": v2}
   self.assertEqual(snt.format_variable_map(var_map), expected)
Exemplo n.º 4
0
 def testFormatVariableMap(self, use_resource, expected):
   with tf.variable_scope("m1"):
     v1 = tf.get_variable("v1", shape=[3, 4], use_resource=use_resource)
   with tf.device("/gpu"):
     with tf.variable_scope("m2"):
       v2 = tf.get_local_variable(
           "v2", shape=[5, 6], use_resource=use_resource)
   var_map = {"vv1": v1, "vv2": v2}
   self.assertEqual(snt.format_variable_map(var_map), expected)
Exemplo n.º 5
0
 def testFormatVariableMap(self):
   with tf.variable_scope("m1"):
     v1 = tf.get_variable("v1", shape=[3, 4])
   with tf.variable_scope("m2"):
     v2 = tf.get_variable("v2", shape=[5, 6])
   var_map = {"vv1": v1, "vv2": v2}
   self.assertEquals(snt.format_variable_map(var_map),
                     ("Key  Variable  Shape  Type\n"
                      "vv1  m1/v1:0   3x4    tf.float32\n"
                      "vv2  m2/v2:0   5x6    tf.float32"))