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

Function _enclosing_power_of_two

tensorflow/python/ops/signal/spectral_ops.py:278–289  ·  view source on GitHub ↗

Return 2**N for integer N such that 2**N >= value.

(value)

Source from the content-addressed store, hash-verified

276
277
278def _enclosing_power_of_two(value):
279 """Return 2**N for integer N such that 2**N >= value."""
280 value_static = tensor_util.constant_value(value)
281 if value_static is not None:
282 return constant_op.constant(
283 int(2**np.ceil(np.log(value_static) / np.log(2.0))), value.dtype)
284 return math_ops.cast(
285 math_ops.pow(
286 2.0,
287 math_ops.ceil(
288 math_ops.log(math_ops.cast(value, dtypes.float32)) /
289 math_ops.log(2.0))), value.dtype)

Callers 2

stftFunction · 0.85
inverse_stftFunction · 0.85

Calls 3

constantMethod · 0.45
logMethod · 0.45
castMethod · 0.45

Tested by

no test coverage detected