ERROR: MethodError: objects of type Tuple{Dense.... } are not callable.
- Dominant language
- Julia
- Stars
- 240
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
Trying to build a very basic example by using Flux and Torch. My WE contains the following packages:
The packages that I have :
```julia
[052768ef] CUDA v5.6.1
[587475ba] Flux v0.16.2
[dbeba491] Metalhead v0.9.5
[3bd65402] Optimisers v0.4.4
[6a2ea274] Torch v0.1.3
[e88e6eb3] Zygote v0.7.3
⌅ [4ee394cb] CUDA_Driver_jll v0.10.4+0
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated`
```
Then I call CUDA and Torch packages :
```julia
julia> using CUDA
julia> using Torch
```
When I call ```Flux```, it warns me about cuDNN. (Which I also installed but it gives some other error.)
``` julia
julia> using Flux
┌ Warning: Package cuDNN not found in current path.
│ - Run `import Pkg; Pkg.add("cuDNN")` to install the cuDNN package, then restart julia.
│ - If cuDNN is not installed, some Flux functionalities will not be available when running on the GPU.
└ @ FluxCUDAExt ~/.julia/packages/Flux/BkG8S/ext/FluxCUDAExt/FluxCUDAExt.jl:10
```
Just a basic FFNN.
```julia
julia> net = Chain(
Dense(10, 5, σ),
Dense(5, 2),
softmax)
Chain(
Dense(10 => 5, σ), # 55 parameters
Dense(5 => 2), # 12 parameters
softmax,
) # Total: 4 arrays, 67 parameters, 476 bytes.
```
Then When I try to convert the model to torch, everything seems fine.
```julia
julia> torch_net = net.layers |> torch
(Dense(10 => 5, σ), Dense(5 => 2), softmax)
```
Preparing the input data.
```julia
julia> ip = rand(Float32, 10);
julia> tip = tensor(ip, dev = 0)
10-element Tensor{Float32, 1}:
0.17900974
0.21817732
0.35327947
0.004907012
0.34559655
0.7998144
0.5324366
0.83601516
0.8809979
0.9549317
```
And giving the input to the model - torch_net produces :
```julia
julia> torch_net(tip)
ERROR: MethodError: objects of type Tuple{Dense{typeof(σ), Tensor{Float32, 2}, Tensor{Float32, 1}}, Dense{typeof(identity), Tensor{Float32, 2}, Tensor{Float32, 1}}, typeof(softmax)} are not callable
The object of type `Tuple{Dense{typeof(σ), Tensor{Float32, 2}, Tensor{Float32, 1}}, Dense{typeof(identity), Tensor{Float32, 2}, Tensor{Float32, 1}}, typeof(softmax)}` exists, but no method is defined for this combination of argument types when trying to treat it as a callable object.
Stacktrace:
[1] top-level scope
@ REPL[25]:1
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.