-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathmax_pool2d.py
More file actions
42 lines (34 loc) · 964 Bytes
/
max_pool2d.py
File metadata and controls
42 lines (34 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import functools
import ninetoothed.language as ntl
from ninetoothed import Tensor
from ntops.kernels.pooling import arrangement
def application(input, output):
output = ntl.max(input, axis=-1) # noqa: F841
def premake(
kernel_size_h=None,
kernel_size_w=None,
stride_h=None,
stride_w=None,
padding_h=None,
padding_w=None,
dilation_h=None,
dilation_w=None,
ceil_mode=None,
dtype=None,
block_size=None,
):
arrangement_ = functools.partial(
arrangement,
kernel_size_h=kernel_size_h,
kernel_size_w=kernel_size_w,
stride_h=stride_h,
stride_w=stride_w,
padding_h=padding_h,
padding_w=padding_w,
dilation_h=dilation_h,
dilation_w=dilation_w,
ceil_mode=ceil_mode,
block_size=block_size,
)
tensors = (Tensor(4, dtype=dtype, other=float("-inf")), Tensor(4, dtype=dtype))
return arrangement_, application, tensors