Skip to content

Commit

Permalink
make non-const conv1d available to stable rust (#911)
Browse files Browse the repository at this point in the history
* make device capable of Conv1DKernel<E>

* make non-const conv1d available to stable rust

---------

Co-authored-by: Corey Lowman <clowman1993@gmail.com>
  • Loading branch information
optman and coreylowman authored Jan 25, 2024
1 parent a4a271f commit e04dd4f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions dfdx-core/src/tensor_ops/conv1d/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mod tests;

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub(super) struct Conv1DOp {
pub struct Conv1DOp {
pub kernel: usize,
pub stride: usize,
pub padding: usize,
Expand All @@ -22,7 +22,7 @@ pub(super) struct Conv1DOp {
pub l_out: usize,
}

pub(super) trait Conv1DKernel<E: Dtype>: Storage<E> {
pub trait Conv1DKernel<E: Dtype>: Storage<E> {
fn alloc<S: Shape>(&self, s: S) -> Result<Tensor<S, E, Self>, Error>;

fn forward<L: Shape, R: Shape, O: Shape>(
Expand Down Expand Up @@ -108,6 +108,7 @@ pub trait TryConv1D<Stride, Padding, Dilation, Groups>: Sized {
) -> Result<Self::Convolved, Error>;
}

#[cfg(feature = "nightly")]
impl<
const KERNEL: usize,
const STRIDE: usize,
Expand Down
2 changes: 0 additions & 2 deletions dfdx-core/src/tensor_ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,7 @@ pub use upscale2d::{
};
pub use var_to::VarTo;

#[cfg(feature = "nightly")]
mod conv1d;
#[cfg(feature = "nightly")]
pub use conv1d::TryConv1D;

#[cfg(feature = "nightly")]
Expand Down
3 changes: 3 additions & 0 deletions dfdx-core/src/tensor_ops/utilities/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ pub trait Device<E: Dtype>:
+ BinaryKernel<super::super::maximum::MaximumKernelOp, E>
+ BinaryKernel<super::super::minimum::MinimumKernelOp, E>
+ crate::tensor_ops::axpy::AxpyKernel<E>

// conv1d
+ super::super::conv1d::Conv1DKernel<E>
{
}

Expand Down

0 comments on commit e04dd4f

Please sign in to comment.