π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
optimized find_next_powerof_two by 3.71x (371% speedup) (#3250)
Sidda49b2c1df23d
diff --git a/kornia/geometry/transform/pyramid.py b/kornia/geometry/transform/pyramid.pyindex bd9d56556..644c0fdda 100644--- a/kornia/geometry/transform/pyramid.py+++ b/kornia/geometry/transform/pyramid.py@@ -373,9 +373,7 @@ def is_powerof_two(x: int) -> bool:def find_next_powerof_two(x: int) -> int:- # return the nearest power of 2- n = math.ceil(math.log(x) / math.log(2))- return 2**n+ return 1 << (x - 1).bit_length()def build_laplacian_pyramid(