You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, in my programming design, I need an operation for data storage. I want to store a three-dimensional array as a Vector{NamedTuple} type and then use it for computations. The simplified and reproducible computation process is as follows:
using Zygote
symbols = [Symbol("a_$i") for i in 1:8]
function loss(p)
input = ones(2, 3, 10)
data = [ones(3, 3, 10), ones(1, 3, 10), ones(2, 3, 10)]
for d in data
input = cat(input, d .* p, dims=1)
end
tmp = [NamedTuple{Tuple(symbols)}(eachslice(input[:, i, :], dims=1)) for i in 1:3]
sum(tmp[1][:a_1])
end
Zygote.gradient(loss, 2.0)
After running the program, the following error occurred:
Hello, in my programming design, I need an operation for data storage. I want to store a three-dimensional array as a Vector{NamedTuple} type and then use it for computations. The simplified and reproducible computation process is as follows:
After running the program, the following error occurred:
May I ask which part of my code does not comply with the standards?
The text was updated successfully, but these errors were encountered: