Skip to content

Commit

Permalink
Generate DWCONV CHW microkernel tests from a YAML specification
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 338783962
  • Loading branch information
Maratyszcza authored and xnnpack-bot committed Oct 24, 2020
1 parent 0dde1af commit dc6c77f
Show file tree
Hide file tree
Showing 5 changed files with 1,186 additions and 933 deletions.
3 changes: 3 additions & 0 deletions scripts/generate-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ tools/generate-avgpool-test.py --spec test/f32-pavgpool-minmax.yaml --output tes

### Tests for ArgMaxPool micro-kernels
tools/generate-argmaxpool-test.py --spec test/f32-argmaxpool.yaml --output test/f32-argmaxpool.cc

### Tests for DWConv CHW micro-kernels
tools/generate-dwconv-chw-test.py --spec test/f32-dwconv-chw.yaml --output test/f32-dwconv-chw.cc
23 changes: 14 additions & 9 deletions test/dwconv-chw-microkernel-tester.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,14 @@ class DWConvCHWMicrokernelTester {
return this->padding_bottom_;
}

inline DWConvCHWMicrokernelTester& input_height(uint32_t input_height) {
assert(input_height >= 1);
this->input_height_ = input_height;
return *this;
}

inline uint32_t input_height() const {
return (output_height() - 1) * subsampling() + kernel_height() - padding_top() - padding_bottom();
return this->input_height_;
}

inline DWConvCHWMicrokernelTester& input_width(uint32_t input_width) {
Expand Down Expand Up @@ -118,14 +124,13 @@ class DWConvCHWMicrokernelTester {
return kernel_height() * kernel_width();
}

inline DWConvCHWMicrokernelTester& output_height(uint32_t output_height) {
assert(output_height >= 1);
this->output_height_ = output_height;
return *this;
}

inline uint32_t output_height() const {
return this->output_height_;
const uint32_t padded_input_height = padding_top() + input_height() + padding_bottom();
if (padded_input_height <= kernel_height()) {
return 1;
} else {
return (padded_input_height - kernel_height()) / subsampling() + 1;
}
}

inline uint32_t output_width() const {
Expand Down Expand Up @@ -246,7 +251,7 @@ class DWConvCHWMicrokernelTester {
uint32_t padding_right_{0};
uint32_t padding_top_{0};
uint32_t padding_bottom_{0};
uint32_t output_height_{1};
uint32_t input_height_{1};
uint32_t input_width_{1};
uint32_t subsampling_{1};
uint32_t kernel_height_{1};
Expand Down
Loading

0 comments on commit dc6c77f

Please sign in to comment.