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

Commit 286e0bc

Browse files
committed
Refactor test
1 parent 0f95138 commit 286e0bc

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

test/loss.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
𝐲̂ = rand(1, 3, 3, 5)
44

55
feature_dims = 2:3
6-
loss = mean(.√(sum(abs2, 𝐲̂-𝐲, dims=feature_dims)))
6+
loss = sum(.√(sum(abs2, 𝐲̂-𝐲, dims=feature_dims)))
7+
y_norm = sum(.√(sum(abs2, 𝐲, dims=feature_dims)))
78

8-
@test l₂loss(𝐲̂, 𝐲) loss/prod(feature_dims)
9+
@test l₂loss(𝐲̂, 𝐲) loss/y_norm
910
end

test/model.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@testset "FourierNeuralOperator" begin
22
m = FourierNeuralOperator()
33

4-
𝐱, 𝐲 = rand(Float32, 2, 1024, 5), rand(Float32, 1024, 5)
4+
𝐱, 𝐲 = rand(Float32, 2, 1024, 5), rand(Float32, 1, 1024, 5)
55
@test size(m(𝐱)) == size(𝐲)
66

77
loss(𝐱, 𝐲) = sum(abs2, 𝐲 .- m(𝐱)) / size(𝐱)[end]

test/runtests.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ using Flux
44
using GeometricFlux
55
using Graphs
66
using Zygote
7-
using Statistics
87
using Test
98

109
CUDA.allowscalar(false)

0 commit comments

Comments
 (0)