Add files via upload
This commit is contained in:
parent
ec4b7eae41
commit
8a3d9451e0
1 changed files with 20 additions and 0 deletions
20
reproduction_effort/functions/binning.py
Normal file
20
reproduction_effort/functions/binning.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import torch
|
||||||
|
|
||||||
|
|
||||||
|
def binning(
|
||||||
|
data: torch.Tensor,
|
||||||
|
kernel_size: int = 4,
|
||||||
|
stride: int = 4,
|
||||||
|
divisor_override: int | None = 1,
|
||||||
|
) -> torch.Tensor:
|
||||||
|
|
||||||
|
return (
|
||||||
|
torch.nn.functional.avg_pool2d(
|
||||||
|
input=data.movedim(0, -1).movedim(0, -1),
|
||||||
|
kernel_size=kernel_size,
|
||||||
|
stride=stride,
|
||||||
|
divisor_override=divisor_override,
|
||||||
|
)
|
||||||
|
.movedim(-1, 0)
|
||||||
|
.movedim(-1, 0)
|
||||||
|
)
|
Loading…
Reference in a new issue