use crate::tensor::CubeTensor;
use burn_backend::ops::ConvTransposeOptions;
use cubek::convolution::components::ConvSetupError;
#[cfg(feature = "autotune")]
use super::conv_transpose3d_autotune;
use super::{conv_transpose3d_col2im, conv_transpose3d_direct};
pub enum ConvTranspose3dStrategy {
Direct,
#[cfg(feature = "autotune")]
Autotune,
Gemm,
}
impl Default for ConvTranspose3dStrategy {
fn default() -> Self {
#[cfg(feature = "autotune")]
return ConvTranspose3dStrategy::Autotune;
#[cfg(not(feature = "autotune"))]
ConvTranspose3dStrategy::Direct
}
}
pub fn conv_transpose3d(
input: CubeTensor,
weight: CubeTensor,
bias: Option<CubeTensor>,
options: ConvTransposeOptions<3>,
strategy: ConvTranspose3dStrategy,
) -> Result<CubeTensor, ConvSetupError> {
match strategy {
ConvTranspose3dStrategy::Direct => conv_transpose3d_direct(input, weight, bias, options),
#[cfg(feature = "autotune")]
ConvTranspose3dStrategy::Autotune => {
Ok(conv_transpose3d_autotune(input, weight, bias, options))
}
ConvTranspose3dStrategy::Gemm => conv_transpose3d_col2im(input, weight, bias, options),
}
}