MCPcopy Create free account
hub / github.com/pytorch/executorch / kernel_check

Function kernel_check

backends/arm/operator_support/pool_2d_support.py:28–43  ·  view source on GitHub ↗

Check if kernel size is within U55 constraints. Checks that ``kernel_x * kernel_y`` is in ``[1, 65536]`` and ``kernel_y`` is in ``[1, 256]`` as required by the U55 profile. Args: kernel (tuple[int, int]): Kernel height and width ``(kh, kw)``. Returns: bool: True if

(kernel: tuple[int, int])

Source from the content-addressed store, hash-verified

26
27
28def kernel_check(kernel: tuple[int, int]) -> bool:
29 """Check if kernel size is within U55 constraints.
30
31 Checks that ``kernel_x * kernel_y`` is in ``[1, 65536]`` and
32 ``kernel_y`` is in ``[1, 256]`` as required by the U55 profile.
33
34 Args:
35 kernel (tuple[int, int]): Kernel height and width ``(kh, kw)``.
36
37 Returns:
38 bool: True if the kernel passes validation.
39
40 """
41 if not (1 <= kernel[0] * kernel[1] <= 65536):
42 return False
43 return 1 <= kernel[1] <= 256
44
45
46def stride_check(strides: tuple[int, int]) -> bool:

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected