def test_filter_matrix(self): np_inv_power = wpe.get_power_inverse(self.Y) np_filter_matrix = wpe.get_filter_matrix_conj_v5( self.Y, np_inv_power, self.K, self.delay) with tf.Graph().as_default(), tf.Session() as sess: tf_signal = tf.placeholder(tf.complex128, shape=[None, None]) tf_inverse_power = tf_wpe.get_power_inverse(tf_signal) tf_matrix, tf_vector = tf_wpe.get_correlations_for_single_frequency( tf_signal, tf_inverse_power, self.K, self.delay) tf_filter = tf_wpe.get_filter_matrix_conj(tf_signal, tf_matrix, tf_vector, self.K, self.delay) tf_filter_matrix, tf_inv_power_2 = sess.run( [tf_filter, tf_inverse_power], {tf_signal: self.Y}) np.testing.assert_allclose(np_inv_power, tf_inv_power_2) np.testing.assert_allclose(np_filter_matrix, tf_filter_matrix)
def test_filter_operation(self): np_inv_power = wpe.get_power_inverse(self.Y) np_filter_matrix = wpe.get_filter_matrix_conj_v5( self.Y, np_inv_power, self.K, self.delay) np_filter_op = wpe.perform_filter_operation_v4(self.Y, np_filter_matrix, self.K, self.delay) with tf.Graph().as_default(), tf.Session() as sess: tf_signal = tf.placeholder(tf.complex128, shape=[None, None]) tf_inverse_power = tf_wpe.get_power_inverse(tf_signal) tf_matrix, tf_vector = tf_wpe.get_correlations_narrow( tf_signal, tf_inverse_power, self.K, self.delay) tf_filter = tf_wpe.get_filter_matrix_conj(tf_signal, tf_inverse_power, tf_matrix, tf_vector, self.K, self.delay) tf_filter_op = tf_wpe.perform_filter_operation( tf_signal, tf_filter, self.K, self.delay) tf_filter_op = sess.run(tf_filter_op, {tf_signal: self.Y}) np.testing.assert_allclose(np_filter_op, tf_filter_op)