MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / idct

Function idct

tensorflow/python/ops/signal/dct_ops.py:168–207  ·  view source on GitHub ↗

Computes the 1D [Inverse Discrete Cosine Transform (DCT)][idct] of `input`. Currently only Types I, II and III are supported. Type III is the inverse of Type II, and vice versa. Note that you must re-normalize by 1/(2n) to obtain an inverse if `norm` is not `'ortho'`. That is: `signal ==

(input, type=2, n=None, axis=-1, norm=None, name=None)

Source from the content-addressed store, hash-verified

166# TODO(rjryan): Implement `n` and `axis` parameters.
167@tf_export("signal.idct", v1=["signal.idct", "spectral.idct"])
168def idct(input, type=2, n=None, axis=-1, norm=None, name=None): # pylint: disable=redefined-builtin
169 """Computes the 1D [Inverse Discrete Cosine Transform (DCT)][idct] of `input`.
170
171 Currently only Types I, II and III are supported. Type III is the inverse of
172 Type II, and vice versa.
173
174 Note that you must re-normalize by 1/(2n) to obtain an inverse if `norm` is
175 not `'ortho'`. That is:
176 `signal == idct(dct(signal)) * 0.5 / signal.shape[-1]`.
177 When `norm='ortho'`, we have:
178 `signal == idct(dct(signal, norm='ortho'), norm='ortho')`.
179
180 @compatibility(scipy)
181 Equivalent to [scipy.fftpack.idct](https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.fftpack.idct.html)
182 for Type-I, Type-II and Type-III DCT.
183 @end_compatibility
184
185 Args:
186 input: A `[..., samples]` `float32` `Tensor` containing the signals to take
187 the DCT of.
188 type: The IDCT type to perform. Must be 1, 2 or 3.
189 n: For future expansion. The length of the transform. Must be `None`.
190 axis: For future expansion. The axis to compute the DCT along. Must be `-1`.
191 norm: The normalization to apply. `None` for no normalization or `'ortho'`
192 for orthonormal normalization.
193 name: An optional name for the operation.
194
195 Returns:
196 A `[..., samples]` `float32` `Tensor` containing the IDCT of `input`.
197
198 Raises:
199 ValueError: If `type` is not `1`, `2` or `3`, `n` is not `None, `axis` is
200 not `-1`, or `norm` is not `None` or `'ortho'`.
201
202 [idct]:
203 https://en.wikipedia.org/wiki/Discrete_cosine_transform#Inverse_transforms
204 """
205 _validate_dct_arguments(input, type, n, axis, norm)
206 inverse_type = {1: 1, 2: 3, 3: 2}[type]
207 return dct(input, type=inverse_type, n=n, axis=axis, norm=norm, name=name)

Callers

nothing calls this directly

Calls 2

_validate_dct_argumentsFunction · 0.85
dctFunction · 0.85

Tested by

no test coverage detected