Skip to content

Commit

Permalink
Add wrapped_as_base_mut impl for other modules
Browse files Browse the repository at this point in the history
  • Loading branch information
elftausend committed Dec 16, 2023
1 parent bd65c7e commit df3f0bd
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ min-cl = { path="../min-cl", optional=true }

[features]
# default = ["cpu", "autograd", "macro"]
default = ["cpu", "static-api", "lazy"]
default = ["cpu", "static-api", "lazy", "autograd", "graph", "fork"]

cpu = []
opencl = ["dep:min-cl", "cpu", "cached"]
Expand Down
5 changes: 5 additions & 0 deletions src/modules/autograd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ impl<Mods: WrappedData> WrappedData for Autograd<Mods> {
fn wrapped_as_base<'a, T, Base: HasId + PtrType>(&self, wrap: &'a Self::Wrap<T, Base>) -> &'a Base {
self.modules.wrapped_as_base(wrap)
}

#[inline]
fn wrapped_as_base_mut<'a, T, Base: HasId + PtrType>(&self, wrap: &'a mut Self::Wrap<T, Base>) -> &'a mut Base {
self.modules.wrapped_as_base_mut(wrap)
}
}

impl<Mods: Module<D>, D: Device> Module<D> for Autograd<Mods> {
Expand Down
5 changes: 5 additions & 0 deletions src/modules/cached.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ impl<Mods: WrappedData, SD: Device> WrappedData for CachedModule<Mods, SD> {
fn wrapped_as_base<'a, T, Base: HasId + PtrType>(&self, wrap: &'a Self::Wrap<T, Base>) -> &'a Base {
self.modules.wrapped_as_base(wrap)
}

#[inline]
fn wrapped_as_base_mut<'a, T, Base: HasId + PtrType>(&self, wrap: &'a mut Self::Wrap<T, Base>) -> &'a mut Base {
self.modules.wrapped_as_base_mut(wrap)
}
}

impl<Mods: Module<D>, D: Device> Module<D> for Cached<Mods> {
Expand Down
5 changes: 5 additions & 0 deletions src/modules/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ impl<Mods: WrappedData> WrappedData for Fork<Mods> {
fn wrapped_as_base<'a, T, Base: HasId + PtrType>(&self, wrap: &'a Self::Wrap<T, Base>) -> &'a Base {
self.modules.wrapped_as_base(wrap)
}

#[inline]
fn wrapped_as_base_mut<'a, T, Base: HasId + PtrType>(&self, wrap: &'a mut Self::Wrap<T, Base>) -> &'a mut Base {
self.modules.wrapped_as_base_mut(wrap)
}
}

impl<Mods: Module<D>, D: Device> Module<D> for Fork<Mods> {
Expand Down
5 changes: 5 additions & 0 deletions src/modules/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ impl<Mods: WrappedData> WrappedData for Graph<Mods> {
fn wrapped_as_base<'a, T, Base: HasId + PtrType>(&self, wrap: &'a Self::Wrap<T, Base>) -> &'a Base {
self.modules.wrapped_as_base(wrap)
}

#[inline]
fn wrapped_as_base_mut<'a, T, Base: HasId + PtrType>(&self, wrap: &'a mut Self::Wrap<T, Base>) -> &'a mut Base {
self.modules.wrapped_as_base_mut(wrap)
}
}

impl<Mods: Module<D>, D: Device> Module<D> for Graph<Mods> {
Expand Down

0 comments on commit df3f0bd

Please sign in to comment.