예제 #1
0
 def testSeparableConvBlock(self):
   x = np.random.rand(5, 7, 1, 11)
   y = common_layers.separable_conv_block(
       tf.constant(x, dtype=tf.float32),
       13, [(1, (3, 3)), (1, (3, 3))],
       padding="SAME")
   self.evaluate(tf.global_variables_initializer())
   res = self.evaluate(y)
   self.assertEqual(res.shape, (5, 7, 1, 13))
예제 #2
0
 def testSeparableConvBlock(self):
     x = np.random.rand(5, 7, 1, 11)
     y = common_layers.separable_conv_block(tf.constant(x,
                                                        dtype=tf.float32),
                                            13, [(1, (3, 3)), (1, (3, 3))],
                                            padding="SAME")
     self.evaluate(tf.global_variables_initializer())
     res = self.evaluate(y)
     self.assertEqual(res.shape, (5, 7, 1, 13))
예제 #3
0
 def xnet_resblock(x, filters, res_relu, name):
   with tf.variable_scope(name):
     y = common_layers.separable_conv_block(
         x,
         filters, [((1, 1), (3, 3)), ((1, 1), (3, 3))],
         first_relu=True,
         padding="SAME",
         force2d=True,
         name="sep_conv_block")
     y = common_layers.pool(y, (3, 3), "MAX", "SAME", strides=(2, 2))
     return y + common_layers.conv_block(
         x,
         filters, [((1, 1), (1, 1))],
         padding="SAME",
         strides=(2, 2),
         first_relu=res_relu,
         force2d=True,
         name="res_conv0")
예제 #4
0
 def xnet_resblock(x, filters, res_relu, name):
   with tf.variable_scope(name):
     y = common_layers.separable_conv_block(
         x,
         filters, [((1, 1), (3, 3)), ((1, 1), (3, 3))],
         first_relu=True,
         padding="SAME",
         force2d=True,
         name="sep_conv_block")
     y = common_layers.pool(y, (3, 3), "MAX", "SAME", strides=(2, 2))
     return y + common_layers.conv_block(
         x,
         filters, [((1, 1), (1, 1))],
         padding="SAME",
         strides=(2, 2),
         first_relu=res_relu,
         force2d=True,
         name="res_conv0")
예제 #5
0
 def xnet_resblock(x, filters, res_relu, name):
   with tf.variable_scope(name):
     # We only stride along the length dimension to preserve the spectral
     # bins (which are tiny in dimensionality relative to length)
     y = common_layers.separable_conv_block(
         x,
         filters, [((1, 1), (3, 3)), ((1, 1), (3, 3))],
         first_relu=True,
         padding="SAME",
         force2d=True,
         name="sep_conv_block")
     y = common_layers.pool(y, (3, 3), "MAX", "SAME", strides=(2, 1))
     return y + common_layers.conv_block(
         x,
         filters, [((1, 1), (1, 1))],
         padding="SAME",
         strides=(2, 1),
         first_relu=res_relu,
         force2d=True,
         name="res_conv0")
예제 #6
0
 def xnet_resblock(x, filters, res_relu, name):
   with tf.variable_scope(name):
     # Typically audio samples are >100k samples in length and have a width
     # of 2 or 4. Mono audio has a single channel while stereo has 2.
     y = common_layers.separable_conv_block(
         x,
         filters, [((1, 1), (3, 3)), ((1, 1), (3, 3))],
         first_relu=True,
         padding="SAME",
         force2d=True,
         name="sep_conv_block")
     y = common_layers.pool(y, (3, 3), "MAX", "SAME", strides=(2, 2))
     return y + common_layers.conv_block(
         x,
         filters, [((1, 1), (1, 1))],
         padding="SAME",
         strides=(2, 2),
         first_relu=res_relu,
         force2d=True,
         name="res_conv0")
예제 #7
0
 def xnet_resblock(x, filters, res_relu, name):
   with tf.variable_scope(name):
     # We only stride along the length dimension to preserve the spectral
     # bins (which are tiny in dimensionality relative to length)
     y = common_layers.separable_conv_block(
         x,
         filters, [((1, 1), (3, 3)), ((1, 1), (3, 3))],
         first_relu=True,
         padding="SAME",
         force2d=True,
         name="sep_conv_block")
     y = common_layers.pool(y, (3, 3), "MAX", "SAME", strides=(2, 1))
     return y + common_layers.conv_block(
         x,
         filters, [((1, 1), (1, 1))],
         padding="SAME",
         strides=(2, 1),
         first_relu=res_relu,
         force2d=True,
         name="res_conv0")
예제 #8
0
 def xnet_resblock(x, filters, res_relu, name):
   with tf.variable_scope(name):
     # Typically audio samples are >100k samples in length and have a width
     # of 2 or 4. Mono audio has a single channel while stereo has 2.
     y = common_layers.separable_conv_block(
         x,
         filters, [((1, 1), (3, 3)), ((1, 1), (3, 3))],
         first_relu=True,
         padding="SAME",
         force2d=True,
         name="sep_conv_block")
     y = common_layers.pool(y, (3, 3), "MAX", "SAME", strides=(2, 2))
     return y + common_layers.conv_block(
         x,
         filters, [((1, 1), (1, 1))],
         padding="SAME",
         strides=(2, 2),
         first_relu=res_relu,
         force2d=True,
         name="res_conv0")