Beispiel #1
0
 def convfn(x, hparams):
   return common_layers.subseparable_conv(
       x,
       hparams.hidden_size // div, (kw, kh),
       padding="SAME",
       separability=sep,
       name="conv_%d%d_sep%d_div%d" % (kw, kh, sep, div))
 def convfn(x, hparams):
     return common_layers.subseparable_conv(
         x,
         hparams.hidden_size // div, (kw, kh),
         padding="SAME",
         separability=sep,
         name="conv_%d%d_sep%d_div%d" % (kw, kh, sep, div))
 def testSubSeparableConv(self):
   for sep in [0, 1, 2, 4]:
     x = np.random.rand(5, 7, 1, 12)
     with tf.variable_scope("sep_%d" % sep):
       y = common_layers.subseparable_conv(
           tf.constant(x, dtype=tf.float32), 16, (3, 1), separability=sep)
     self.evaluate(tf.global_variables_initializer())
     res = self.evaluate(y)
     self.assertEqual(res.shape, (5, 5, 1, 16))
 def testSubSeparableConv(self):
   for sep in [0, 1, 2, 4]:
     x = np.random.rand(5, 7, 1, 12)
     with tf.variable_scope("sep_%d" % sep):
       y = common_layers.subseparable_conv(
           tf.constant(x, dtype=tf.float32), 16, (3, 1), separability=sep)
     self.evaluate(tf.global_variables_initializer())
     res = self.evaluate(y)
     self.assertEqual(res.shape, (5, 5, 1, 16))