@@ -4632,6 +4632,20 @@ struct test_conv_2d_dw : public test_case {
46324632 }
46334633};
46344634
4635+ static inline int64_t conv_out_size (int64_t ins, int64_t ks, int stride, int pad, int dilation) {
4636+ return (ins + 2 * pad - dilation * (ks - 1 ) - 1 ) / stride + 1 ;
4637+ }
4638+ // GGML_OP_PAD
4639+ static inline int64_t wrap_coord_circular (int64_t coord, int64_t size) {
4640+ GGML_ASSERT (size > 0 );
4641+ const int64_t mod = coord % size;
4642+ return mod < 0 ? mod + size : mod;
4643+ }
4644+
4645+ static inline int64_t offset4d (const int64_t ne[4 ], int64_t i0, int64_t i1, int64_t i2, int64_t i3) {
4646+ return ((i3 * ne[2 ] + i2) * ne[1 ] + i1) * ne[0 ] + i0;
4647+ }
4648+
46354649struct test_conv_2d_direct_circular_manual : public test_case {
46364650 const std::array<int64_t , 4 > ne_input{5 , 4 , 1 , 1 };
46374651 const std::array<int64_t , 4 > ne_kernel{3 , 3 , 1 , 1 };
@@ -5597,20 +5611,7 @@ struct test_acc : public test_case {
55975611 }
55985612};
55995613
5600- // GGML_OP_PAD
5601- static inline int64_t wrap_coord_circular (int64_t coord, int64_t size) {
5602- GGML_ASSERT (size > 0 );
5603- const int64_t mod = coord % size;
5604- return mod < 0 ? mod + size : mod;
5605- }
56065614
5607- static inline int64_t offset4d (const int64_t ne[4 ], int64_t i0, int64_t i1, int64_t i2, int64_t i3) {
5608- return ((i3 * ne[2 ] + i2) * ne[1 ] + i1) * ne[0 ] + i0;
5609- }
5610-
5611- static inline int64_t conv_out_size (int64_t ins, int64_t ks, int stride, int pad, int dilation) {
5612- return (ins + 2 * pad - dilation * (ks - 1 ) - 1 ) / stride + 1 ;
5613- }
56145615
56155616struct test_pad : public test_case {
56165617 const ggml_type type;
0 commit comments