コード例 #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)
コード例 #2
0
ファイル: util_test.py プロジェクト: geniusjiqing/sonnet
 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)
コード例 #3
0
ファイル: util_test.py プロジェクト: ccchang0111/sonnet
 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)
コード例 #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)
コード例 #5
0
ファイル: util_test.py プロジェクト: zxshinxz/sonnet
 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"))