FluxJS.jl
FluxJS.jl copied to clipboard
LoadError: indexing not defined for FluxJS.StagedArray{Float64,2}
I tried to run this basic code for a cppn
using Flux
using Images
using FluxJS
function transform(z)
x_dim = 256
y_dim = 256
n_points = x_dim*y_dim
scale = 8
z_dim = 32
net_size = 32
x_range = scale*(collect(0:(x_dim-1))-(x_dim-1)/2.0)/(x_dim-1)/0.5
y_range = scale*(collect(0:(y_dim-1))-(y_dim-1)/2.0)/(y_dim-1)/0.5
x_mat = ones(y_dim, 1)*reshape(x_range, 1, x_dim)
y_mat = reshape(y_range, y_dim, 1)*ones((1, x_dim))
r_mat = sqrt.(x_mat.^2 + y_mat.^2)
x_mat = reshape(transpose(x_mat), n_points)
y_mat = reshape(transpose(y_mat), n_points)
r_mat = reshape(transpose(r_mat), n_points)
unit = Dense(n_points, net_size)
unit(x_mat) + unit(y_mat) + unit(r_mat)
end
model = Chain(
transform,
Dense(32, 32, tanh),
Dense(32, 32, tanh),
Dense(32, 32, tanh),
Dense(32, 32, σ)
)
@code_js model(rand(32))
Possibly related: I get the error below when trying to export the decoder from the autoencoder example in model-zoo.
typeof(f) = Base.#size
size
Tuple{FluxJS.StagedArray{Real,1}}
no method found for the specified argument types
I think we just need to add support for the reshape op. It's a bit of a shame that the error message for missing ops are so bad, but I'm not sure what to do about that right now.