def testDiff(self, shape, axis): x_np = np.random.randn(*shape) x_tf = tf.convert_to_tensor(x_np) res_np = np.diff(x_np, axis=axis) with self.cached_session() as sess: res_tf = sess.run(spectral_ops.diff(x_tf, axis=axis)) self.assertEqual(res_np.shape, res_tf.shape) self.assertAllClose(res_np, res_tf)