Join us at TensorFlow World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

tf.signal.dct

TensorFlow 2.0 version View source on GitHub

Computes the 1D Discrete Cosine Transform (DCT) of input.

Aliases:

  • tf.compat.v1.signal.dct
  • tf.compat.v1.spectral.dct
  • tf.compat.v2.signal.dct
  • tf.spectral.dct
tf.signal.dct(
    input,
    type=2,
    n=None,
    axis=-1,
    norm=None,
    name=None
)

Currently only Types I, II and III are supported. Type I is implemented using a length 2N padded tf.signal.rfft. Type II is implemented using a length 2N padded tf.signal.rfft, as described here: Type 2 DCT using 2N FFT padded (Makhoul). Type III is a fairly straightforward inverse of Type II (i.e. using a length 2N padded tf.signal.irfft).

Args:

  • input: A [..., samples] float32 Tensor containing the signals to take the DCT of.
  • type: The DCT type to perform. Must be 1, 2 or 3.
  • n: For future expansion. The length of the transform. Must be None.
  • axis: For future expansion. The axis to compute the DCT along. Must be -1.
  • norm: The normalization to apply. None for no normalization or 'ortho' for orthonormal normalization.
  • name: An optional name for the operation.

Returns:

A [..., samples] float32 Tensor containing the DCT of input.

Raises:

  • ValueError: If type is not 1, 2 or 3, n is not None,axisis not-1, ornormis notNoneor'ortho'`.
  • ValueError: If type is 1 and norm is ortho.

Scipy Compatibility

Equivalent to scipy.fftpack.dct for Type-I, Type-II and Type-III DCT.