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

Commit d8e84c6

Browse files
committed
Add test for loss
1 parent 3f8416a commit d8e84c6

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

test/loss.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@testset "loss" begin
2+
𝐲 = rand(1, 3, 3, 5)
3+
𝐲̂ = rand(1, 3, 3, 5)
4+
5+
feature_dims = 2:3
6+
loss = mean(.√(sum(abs2, 𝐲̂-𝐲, dims=feature_dims)))
7+
8+
@test l₂loss(𝐲̂, 𝐲) loss/prod(feature_dims)
9+
end

test/runtests.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,21 @@ using Flux
44
using GeometricFlux
55
using Graphs
66
using Zygote
7+
using Statistics
78
using Test
89

910
CUDA.allowscalar(false)
1011

1112
cuda_tests = [
12-
"cuda",
13+
"cuda.jl",
1314
]
1415

1516
tests = [
16-
"Transform/Transform",
17-
"operator_kernel",
18-
"model",
19-
"deeponet",
17+
"Transform/Transform.jl",
18+
"operator_kernel.jl",
19+
"loss.jl",
20+
"model.jl",
21+
"deeponet.jl",
2022
]
2123

2224
if CUDA.functional()
@@ -27,7 +29,7 @@ end
2729

2830
@testset "NeuralOperators.jl" begin
2931
for t in tests
30-
include("$(t).jl")
32+
include(t)
3133
end
3234
end
3335

0 commit comments

Comments
 (0)