Skip to content

Commit 896849a

Browse files
committed
Revert lifetime commits -> lifetime-on-devs branch
1 parent d668013 commit 896849a

File tree

23 files changed

+141
-785
lines changed

23 files changed

+141
-785
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ min-cl = { git = "https://github.com/elftausend/min-cl", optional = true }
5353
[features]
5454
# default = ["cpu", "opencl", "cuda", "blas", "static-api", "stack", "macro", "nnapi", "untyped", "autograd", "autograd", "cached", "lazy", "fork", "graph", "serde"]
5555
# default = ["no-std"]
56-
# default = ["cpu"]
57-
default = ["untyped", "cpu", "lazy", "graph", "autograd", "fork", "serde", "json", "half", "cached", "static-api", "stack", "opencl", "cuda", "vulkan"]
56+
# default = ["cuda"]
57+
default = ["untyped", "cpu", "lazy", "graph", "autograd", "fork", "serde", "json", "half", "cached", "static-api", "stack", "opencl"]
5858

5959
std = []
6060

examples/custom_device.rs

Lines changed: 0 additions & 231 deletions
This file was deleted.

examples/custom_module.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub struct CustomModule<Mods> {
99

1010
// bare minimum to implement a custom module
1111

12-
impl<'a, D: 'a, Mods: Module<'a, D>> Module<'a, D> for CustomModule<Mods> {
12+
impl<D, Mods: Module<D>> Module<D> for CustomModule<Mods> {
1313
type Module = CustomModule<Mods::Module>;
1414

1515
fn new() -> Self::Module {

src/buffer/impl_autograd.rs

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ where
107107
/// This allocates a gradient buffer if it wasn't previously.
108108
#[inline]
109109
#[cfg(feature = "autograd")]
110-
pub fn grad_mut<'b>(&'b self) -> &'b mut Self
110+
pub fn grad_mut(&self) -> &'a mut Self
111111
where
112112
D: MayTapeActions + Alloc<T> + ZeroGrad<T>,
113113
{
@@ -127,7 +127,7 @@ where
127127
/// Returns a mutable reference to the gradient of this buffer.
128128
/// Returns none either if the autograd feature is disabled, no tape was found (add [`Autograd`] module) or no gradient was allocated previously.
129129
// TODO: Maybe return Result with two error variants?
130-
pub fn try_grad_mut<'b>(&'b mut self) -> Option<&'a mut Self>
130+
pub fn try_grad_mut(&self) -> Option<&'a mut Self>
131131
where
132132
D: MayTapeActions + Alloc<T>,
133133
{
@@ -148,30 +148,7 @@ where
148148
/// Activate the `autograd` feature to make this function useable.
149149
#[inline]
150150
#[cfg(not(feature = "autograd"))]
151-
pub fn grad_mut<'b>(&'b mut self) -> &'a mut Self {
151+
pub fn grad_mut(&self) -> &'a mut Self {
152152
unimplemented!("Gradient not available. Activate the autograd feature.");
153153
}
154154
}
155-
156-
mod tests {
157-
use crate::Number;
158-
159-
fn run<T: Number>(x: &mut [T], y: &mut [T]) {
160-
for i in 0..x.len() {
161-
x[i] = y[i] + T::one()
162-
}
163-
}
164-
165-
#[cfg(feature = "cpu")]
166-
#[cfg(feature = "autograd")]
167-
#[test]
168-
fn test_multiple_grad_mut() {
169-
use crate::{Autograd, Base, Cached, Device, CPU};
170-
171-
let device = CPU::<Autograd<Cached<Base>>>::new();
172-
let mut buf = device.buffer([1, 2, 3, 4]);
173-
let _out = buf.grad_mut();
174-
let out = buf.grad_mut();
175-
// run(_out, out);
176-
}
177-
}

0 commit comments

Comments
 (0)