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

Function _validate_dct_arguments

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

Checks that DCT/IDCT arguments are compatible and well formed.

(input_tensor, dct_type, n, axis, norm)

Source from the content-addressed store, hash-verified

28from tensorflow.python.util.tf_export import tf_export
29
30def _validate_dct_arguments(input_tensor, dct_type, n, axis, norm):
31 """Checks that DCT/IDCT arguments are compatible and well formed."""
32 if axis != -1:
33 raise NotImplementedError("axis must be -1. Got: %s" % axis)
34 if n is not None and n < 1:
35 raise ValueError("n should be a positive integer or None")
36 if dct_type not in (1, 2, 3):
37 raise ValueError("Only Types I, II and III (I)DCT are supported.")
38 if dct_type == 1:
39 if norm == "ortho":
40 raise ValueError("Normalization is not supported for the Type-I DCT.")
41 if input_tensor.shape[-1] is not None and input_tensor.shape[-1] < 2:
42 raise ValueError(
43 "Type-I DCT requires the dimension to be greater than one.")
44
45 if norm not in (None, "ortho"):
46 raise ValueError(
47 "Unknown normalization. Expected None or 'ortho', got: %s" % norm)
48
49
50# TODO(rjryan): Implement `axis` parameter.

Callers 2

dctFunction · 0.85
idctFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected