Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

BoundsError during training process #137

Closed
jcvillaquira opened this issue Jul 21, 2023 · 0 comments
Closed

BoundsError during training process #137

jcvillaquira opened this issue Jul 21, 2023 · 0 comments

Comments

@jcvillaquira
Copy link

Hi, I am training a NeuralOperator to model a map that takes two one-dimensional functions to a two-dimensional function. However it always gives error somewhere in the training process. Here is a minimal working example

# nt = temporal discretisation, nx = spatiall discretisation
nt = 10
nx = 20
n_samples = 100

# Generate data.
x_data = rand(2, nx, n_samples) # Two functions as input
y_data = rand(nt, nx, n_samples) # Two-dimensional function with size nt x nx
data_train, data_test = splitobs((Float32.(x_data), Float32.(y_data)), at = 0.9)
loader = DataLoader(data_train), DataLoader(data_test)

# Create model.
model = FourierNeuralOperator(ch = (2, 64, 64, 64, 64, 64, 128, nt), σ = gelu)
optimiser = Flux.Optimiser(WeightDecay(1.0f-4), Flux.Adam(1.0f-3))
data = collect.(loader)

# Train model
learner = Learner(model, data, optimiser, l₂loss)
fit!(learner, 1)

I always get BoundsError in the code

ERROR: BoundsError: attempt to access 11×64×1 Array{ComplexF32, 3} at index [1:16, 1:64, 1:1]

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant