Skip to content

Commit 68c251b

Browse files
author
bssrdf
committed
added more checking for precondition to use winograd; switch to im2co if not satisfied
1 parent 5b4e448 commit 68c251b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ggml.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7223,8 +7223,11 @@ struct ggml_tensor * ggml_conv_2d_3x3(
72237223
struct ggml_tensor * a,
72247224
struct ggml_tensor * b){
72257225

7226-
72277226
GGML_ASSERT(b->ne[3] == 1); // only works for 1 input image
7227+
GGML_ASSERT(b->ne[2] == a->ne[2]); // number of channels must match
7228+
if(a->ne[3] % 64 != 0 || a->ne[2] % 8 != 0) // only works for the number of filters is a multiple of 64
7229+
return ggml_conv_2d(ctx, a, b, 1, 1, 1, 1, 1, 1); // and the number of channels is a multiple of 8
7230+
72287231

72297232
struct ggml_tensor* W = ggml_winograd_stage0(ctx, a);
72307233
struct ggml_tensor * result = ggml_winograd_stage1(ctx, W, b);

0 commit comments

Comments
 (0)