mindscience.sciops.dft.DCT

class mindscience.sciops.dft.DCT(shape, compute_dtype=mstype.float32)[source]

1D discrete cosine transformation on real number on the last axis. The results should be same as scipy.fft.dct() . Reference: Type 2 DCT using N FFT (Makhoul) .

Parameters
  • shape (tuple) – The shape of the dimensions to be transformed, other dimensions need not be included. Must be a length-1 tuple.

  • compute_dtype (mindspore.dtype) – The type of input tensor. Default: mstype.float32.

Inputs:
  • a (Tensor) - The real tensor to be transformed, with trailing dimensions aligned with shape.

Outputs:
  • b (Tensor) - The output real tensor, with trailing dimensions aligned with shape.

Examples

>>> from mindspore import ops
>>> from mindflow.cell import DCT
>>> a = ops.rand((2, 32, 512))
>>> dft_cell = DCT(a.shape[-1:])
>>> b = dft_cell(a)
>>> print(b.shape)
(2, 32, 512)