Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"ndarray" and "autograd::ndarray" #42

Closed
laocaoshilaocao opened this issue Apr 25, 2021 · 2 comments
Closed

"ndarray" and "autograd::ndarray" #42

laocaoshilaocao opened this issue Apr 25, 2021 · 2 comments

Comments

@laocaoshilaocao
Copy link

Hi, i am a beginner of this interesting rust deep learning library.
When i try to run several basic examples using ndarray, i found that always has a compiler error saying i should use autograd::ndarray. Code and error are shown as follow:

    ag::with(|g| {
        let x = g.placeholder(&[-1,-1]);
        let value = array![[1., 1.]];  
        println!("{:?}", x.eval(&[x.given(value.view())]).unwrap()); 
    });
error[E0308]: mismatched types
  --> src\main.rs:14:43
   |
14 |         println!("{:?}", x.eval(&[x.given(value.view())]).unwrap());
   |                                           ^^^^^^^^^^^^ expected struct `autograd::ndarray::ArrayBase`, found struct `ndarray::ArrayBase`
   |
   = note: expected struct `autograd::ndarray::ArrayBase<autograd::ndarray::ViewRepr<&_>, _>`
              found struct `ndarray::ArrayBase<ndarray::ViewRepr<&{float}>, ndarray::Dim<[usize; 2]>>`
   = note: perhaps two different versions of crate `ndarray` are being used?

Is that compulsory to use ag::ndarray::array![[1., 1.]] instead of array![[1., 1.]] in this kind of cases?
Thanks for your help.

@laocaoshilaocao
Copy link
Author

Okay, i found that happens because i used the version 0.15.1 of ndarray.
After i changed the dependence version to 0.12.1 everything works.

@raskr
Copy link
Owner

raskr commented Apr 27, 2021

Thank you for the report, yes, ndarray is re-exported to avoid this problem for now.

@raskr raskr closed this as completed Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants