Knet on Julia 1.7.0 (?)

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
[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 :frowning:

Now even so, I try to follow the examples from
and already at the very beginning, when I throw the first example function,
the system complains about the @knet

@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

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

 [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 :slight_smile:

Thanks a lot,


Make sure to use the latest version of the docs:

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.

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.