use coeus_core::{ComputeBackend, Layout, Scalar};
pub trait PoolOps<T: Scalar>: ComputeBackend {
fn max_pool1d(
&self,
input: &Self::DeviceBuffer<T>,
input_layout: &Layout,
kernel_size: usize,
stride: usize,
padding: usize,
dilation: usize,
output: &mut Self::DeviceBuffer<T>,
output_layout: &Layout,
) -> Result<(), Self::Error>;
fn max_pool1d_backward(
&self,
grad_out: &Self::DeviceBuffer<T>,
grad_out_layout: &Layout,
input: &Self::DeviceBuffer<T>,
input_layout: &Layout,
kernel_size: usize,
stride: usize,
padding: usize,
dilation: usize,
grad_input: &mut Self::DeviceBuffer<T>,
grad_input_layout: &Layout,
) -> Result<(), Self::Error>;
fn avg_pool1d(
&self,
input: &Self::DeviceBuffer<T>,
input_layout: &Layout,
kernel_size: usize,
stride: usize,
padding: usize,
dilation: usize,
output: &mut Self::DeviceBuffer<T>,
output_layout: &Layout,
) -> Result<(), Self::Error>;
fn avg_pool1d_backward(
&self,
grad_out: &Self::DeviceBuffer<T>,
grad_out_layout: &Layout,
kernel_size: usize,
stride: usize,
padding: usize,
dilation: usize,
grad_input: &mut Self::DeviceBuffer<T>,
grad_input_layout: &Layout,
) -> Result<(), Self::Error>;
fn max_pool2d(
&self,
input: &Self::DeviceBuffer<T>,
input_layout: &Layout,
kernel_size: usize,
stride: usize,
padding: usize,
dilation: usize,
output: &mut Self::DeviceBuffer<T>,
output_layout: &Layout,
) -> Result<(), Self::Error>;
fn max_pool2d_backward(
&self,
grad_out: &Self::DeviceBuffer<T>,
grad_out_layout: &Layout,
input: &Self::DeviceBuffer<T>,
input_layout: &Layout,
kernel_size: usize,
stride: usize,
padding: usize,
dilation: usize,
grad_input: &mut Self::DeviceBuffer<T>,
grad_input_layout: &Layout,
) -> Result<(), Self::Error>;
fn avg_pool2d(
&self,
input: &Self::DeviceBuffer<T>,
input_layout: &Layout,
kernel_size: usize,
stride: usize,
padding: usize,
dilation: usize,
output: &mut Self::DeviceBuffer<T>,
output_layout: &Layout,
) -> Result<(), Self::Error>;
fn avg_pool2d_backward(
&self,
grad_out: &Self::DeviceBuffer<T>,
grad_out_layout: &Layout,
kernel_size: usize,
stride: usize,
padding: usize,
dilation: usize,
grad_input: &mut Self::DeviceBuffer<T>,
grad_input_layout: &Layout,
) -> Result<(), Self::Error>;
fn max_pool3d(
&self,
input: &Self::DeviceBuffer<T>,
input_layout: &Layout,
kernel_size: usize,
stride: usize,
padding: usize,
dilation: usize,
output: &mut Self::DeviceBuffer<T>,
output_layout: &Layout,
) -> Result<(), Self::Error>;
fn max_pool3d_backward(
&self,
grad_out: &Self::DeviceBuffer<T>,
grad_out_layout: &Layout,
input: &Self::DeviceBuffer<T>,
input_layout: &Layout,
kernel_size: usize,
stride: usize,
padding: usize,
dilation: usize,
grad_input: &mut Self::DeviceBuffer<T>,
grad_input_layout: &Layout,
) -> Result<(), Self::Error>;
fn avg_pool3d(
&self,
input: &Self::DeviceBuffer<T>,
input_layout: &Layout,
kernel_size: usize,
stride: usize,
padding: usize,
dilation: usize,
output: &mut Self::DeviceBuffer<T>,
output_layout: &Layout,
) -> Result<(), Self::Error>;
fn avg_pool3d_backward(
&self,
grad_out: &Self::DeviceBuffer<T>,
grad_out_layout: &Layout,
kernel_size: usize,
stride: usize,
padding: usize,
dilation: usize,
grad_input: &mut Self::DeviceBuffer<T>,
grad_input_layout: &Layout,
) -> Result<(), Self::Error>;
}