# Knet on Julia 1.7.0 (?)

**URL:** <https://discourse.julialang.org/t/knet-on-julia-1-7-0/74860>\
**Category:** Performance\
**Created:** [January 19, 2022, 11:43am UTC](https://discourse.julialang.org/t/knet-on-julia-1-7-0/74860 "2022-01-19T11:43:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazzanti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mazzanti/32/32948_2.png) [@mazzanti](https://discourse.julialang.org/u/mazzanti)\
**Post date:** [January 19, 2022, 11:43am UTC](https://discourse.julialang.org/t/knet-on-julia-1-7-0/74860/1 "2022-01-19T11:43:01Z")

</div>

Hi,  
I just wanted to give Knet a go in my ubuntu machine running Julia 1.7.0, but surprisingly things fail… I just installed it as standard

@(v1.7) pkg\> add Knet  
@(v1.7) pkg\> test Knet  
@(v1.7) pkg\> test Knet  
…  
Testing Running tests…  
kptr.jl Knet: Error During Test at /home/mazzanti/.julia/packages/Knet/RCkV0/test/runtests.jl:7  
Got exception outside of a @test  
LoadError: UndefVarError: usage not defined  
Stacktrace:  
[1] usedmem()  
@ Main ~/.julia/packages/Knet/RCkV0/test/kptr.jl:46  
[2] top-level scope  
@ ~/.julia/packages/Knet/RCkV0/test/kptr.jl:47  
[3] include  
@ ./client.jl:451 [inlined]  
[4] macro expansion  
@ ./timing.jl:220 [inlined]  
[5] macro expansion  
@ ~/.julia/packages/Knet/RCkV0/test/runtests.jl:4 [inlined]  
[6] macro expansion  
@ ~/JULIA/julia-1.7.0/share/julia/stdlib/v1.7/Test/src/Test.jl:1283 [inlined]  
[7] top-level scope  
@ ~/.julia/packages/Knet/RCkV0/test/runtests.jl:11  
[8] include(fname::String)  
@ Base.MainInclude ./client.jl:451  
[9] top-level scope  
@ none:6  
[10] eval  
@ ./boot.jl:373 [inlined]  
[11] exec\_options(opts::Base.JLOptions)  
@ Base ./client.jl:268  
[12] \_start()  
@ Base ./client.jl:495  
in expression starting at /home/mazzanti/.julia/packages/Knet/RCkV0/test/kptr.jl:43  
Test Summary: | Pass Error Total  
Knet | 23 1 24  
kptr:alloc | 8 8  
kptr:gc | 7 7  
kptr:realloc | 8 8  
ERROR: LoadError: Some tests did not pass: 23 passed, 0 failed, 1 errored, 0 broken.  
in expression starting at /home/mazzanti/.julia/packages/Knet/RCkV0/test/runtests.jl:7  
ERROR: Package Knet errored during testing

so it does not pass the tests ☹

Now even so, I try to follow the examples from  
[https://knet.readthedocs.io/en/v0.7.3/intro.html](https://knet.readthedocs.io/en/v0.7.3/intro.html)  
and already at the very beginning, when I throw the first example function,  
the system complains about the @knet

```julia
@knet function linreg(x)
    w = par(dims=(1,13), init=Gaussian(0,0.1))
    b = par(dims=(1,1), init=Constant(0))
    return w * x .+ b
end

LoadError: UndefVarError: @knet not defined
in expression starting at In[2]:1

Stacktrace:
 [1] top-level scope
   @ :0
 [2] eval
   @ ./boot.jl:373 [inlined]
 [3] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1196

```

Now I’m not sure whether this is due to the fact that this tutorial seems old and the macro is no longer available, or because my Knet installation did not make it, or what…

I’ll be more than grateful if somebody here can shed some light onto how to solve these issues 🙂

Thanks a lot,

Ferran.

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [January 19, 2022, 11:58am UTC](https://discourse.julialang.org/t/knet-on-julia-1-7-0/74860/2 "2022-01-19T11:58:12Z")

</div>

Make sure to use the latest version of the docs:

[https://denizyuret.github.io/Knet.jl/latest/](https://denizyuret.github.io/Knet.jl/latest/)

0.7 seems to be an ancient version of Knet, the current version is 1.4, so it’s not surprising that these old docs contain examples that don’t work on the current release.

---

<div class="post-metadata">

**Author:** ![mazzanti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mazzanti/32/32948_2.png) [@mazzanti](https://discourse.julialang.org/u/mazzanti)\
**Post date:** [January 19, 2022, 12:07pm UTC](https://discourse.julialang.org/t/knet-on-julia-1-7-0/74860/3 "2022-01-19T12:07:12Z")

</div>

Yes, probably… but I’m worried about tests not being passed. Besides, the tutorial is very nice and everything is explained in detail. With the new docs this is different.
