示例#1
0
 def test_constant_folding(self):
   """Mel functions should be constant foldable."""
   for dtype in (dtypes.float16, dtypes.float32, dtypes.float64):
     g = ops.Graph()
     with g.as_default():
       mel_matrix = mel_ops.linear_to_mel_weight_matrix(dtype=dtype)
       rewritten_graph = test_util.grappler_optimize(g, [mel_matrix])
       self.assertEqual(1, len(rewritten_graph.node))
示例#2
0
 def test_constant_folding(self):
     """Mel functions should be constant foldable."""
     for dtype in (dtypes.float16, dtypes.float32, dtypes.float64):
         g = ops.Graph()
         with g.as_default():
             mel_matrix = mel_ops.linear_to_mel_weight_matrix(dtype=dtype)
             rewritten_graph = test_util.grappler_optimize(g, [mel_matrix])
             self.assertEqual(1, len(rewritten_graph.node))
 def test_constant_folding(self):
   """Window functions should be constant foldable for constant inputs."""
   for window_fn in (window_ops.hann_window, window_ops.hamming_window):
     for dtype, _ in self._dtypes:
       for periodic in [False, True]:
         g = ops.Graph()
         with g.as_default():
           window = window_fn(100, periodic=periodic, dtype=dtype)
           rewritten_graph = test_util.grappler_optimize(g, [window])
           self.assertEqual(1, len(rewritten_graph.node))
示例#4
0
 def test_constant_folding(self):
     """Window functions should be constant foldable for constant inputs."""
     for window_fn in (window_ops.hann_window, window_ops.hamming_window):
         for dtype, _ in self._dtypes:
             for periodic in [False, True]:
                 g = ops.Graph()
                 with g.as_default():
                     window = window_fn(100, periodic=periodic, dtype=dtype)
                     rewritten_graph = test_util.grappler_optimize(
                         g, [window])
                     self.assertEqual(1, len(rewritten_graph.node))
示例#5
0
 def test_constant_folding(self):
   """frame should be constant foldable for constant inputs."""
   for pad_end in [True, False]:
     g = ops.Graph()
     with g.as_default():
       frame_length, frame_step = 32, 16
       signal_shape = (2, 128)
       signal = array_ops.ones(signal_shape)
       frames = shape_ops.frame(signal, frame_length, frame_step,
                                pad_end=pad_end)
       rewritten_graph = test_util.grappler_optimize(g, [frames])
       self.assertEqual(1, len(rewritten_graph.node))
 def test_constant_folding(self):
     """frame should be constant foldable for constant inputs."""
     for pad_end in [True, False]:
         g = ops.Graph()
         with g.as_default():
             frame_length, frame_step = 32, 16
             signal_shape = (2, 128)
             signal = array_ops.ones(signal_shape)
             frames = shape_ops.frame(signal,
                                      frame_length,
                                      frame_step,
                                      pad_end=pad_end)
             rewritten_graph = test_util.grappler_optimize(g, [frames])
             self.assertEqual(1, len(rewritten_graph.node))