Skip to content

Commit b0813a5

Browse files
committed
Add tests
1 parent 08e30ce commit b0813a5

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
- '["EfficientNet"]'
3232
- 'r"/*/ResNet*"'
3333
- '[r"ResNeXt", r"SEResNet"]'
34+
- '[r"Res2Net", r"Res2NeXt"]'
3435
- '"Inception"'
3536
- '"DenseNet"'
3637
- '["ConvNeXt", "ConvMixer"]'

test/convnets.jl

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,45 @@ end
121121
end
122122
end
123123

124+
@testset "Res2Net" begin
125+
@testset for (base_width, scale) in [(26, 4), (48, 2), (14, 8), (26, 6), (26, 8)]
126+
m = Res2Net(50; base_width, scale)
127+
@test size(m(x_224)) == (1000, 1)
128+
if (Res2Net, depth, cardinality, base_width) in PRETRAINED_MODELS
129+
@test acctest(Res2Net(depth, pretrain = true))
130+
else
131+
@test_throws ArgumentError Res2Net(depth, pretrain = true)
132+
end
133+
@test gradtest(m, x_224)
134+
_gc()
135+
end
136+
@testset for (base_width, scale) in [(26, 4)]
137+
m = Res2Net(101; base_width, scale)
138+
@test size(m(x_224)) == (1000, 1)
139+
if (Res2Net, depth, cardinality, base_width) in PRETRAINED_MODELS
140+
@test acctest(Res2Net(depth, pretrain = true))
141+
else
142+
@test_throws ArgumentError Res2Net(depth, pretrain = true)
143+
end
144+
@test gradtest(m, x_224)
145+
_gc()
146+
end
147+
end
148+
149+
@testset "Res2NeXt" begin
150+
@testset for depth in [50, 101]
151+
m = Res2NeXt(depth)
152+
@test size(m(x_224)) == (1000, 1)
153+
if (Res2NeXt, depth) in PRETRAINED_MODELS
154+
@test acctest(Res2NeXt(depth, pretrain = true))
155+
else
156+
@test_throws ArgumentError Res2NeXt(depth, pretrain = true)
157+
end
158+
@test gradtest(m, x_224)
159+
_gc()
160+
end
161+
end
162+
124163
@testset "EfficientNet" begin
125164
@testset "EfficientNet($config)" for config in [:b0, :b1, :b2, :b3, :b4, :b5] #:b6, :b7, :b8]
126165
# preferred image resolution scaling

0 commit comments

Comments
 (0)