MCPcopy Create free account
hub / github.com/OAID/Tengine / calc_output_size

Function calc_output_size

operator/operator/pooling.cpp:31–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29namespace TEngine {
30
31static int calc_output_size(int input, int kernel, int stride, int pad, int caffe)
32{
33 int output = 1;
34 if(pad >= 0)
35 {
36 if(1 == caffe)
37 {
38 output = 1 + std::ceil((( float )(input - kernel + 2 * pad)) / stride);
39 if(pad > 0 && ((output - 1) * stride >= input + pad))
40 output--;
41 }
42 else if(2 == caffe)
43 {
44 output = 1 + (input - kernel + pad) / stride;
45 }
46 else
47 output = 1 + (input - kernel + 2 * pad) / stride;
48 }
49 else
50 {
51 output = 1 + (input - 1) / stride;
52 }
53 return output;
54}
55
56static void calc_real_pads(int out, int in, int kernel, int stride, int pad, int* pad0, int* pad1)
57{

Callers 1

InferShapeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected