Describes a pooling operation to be enqueued onto a stream via a platform's DnnSupport. TODO(broune): describe how padding works and what happens if the window height/width is not divisible by the vertical/horizontal stride. Arguments: pooling_mode: pooling operator to use on the input patch window_height: height of input window window_width: width of input window vertical_stride: vertical delta
| 708 | // vertical_stride: vertical delta for center of the input patch |
| 709 | // horizontal_stride: horizontal delta for center of the input patch |
| 710 | class PoolingDescriptor { |
| 711 | public: |
| 712 | PoolingDescriptor(); |
| 713 | explicit PoolingDescriptor(int ndims); |
| 714 | |
| 715 | PoolingDescriptor& set_pooling_mode(PoolingMode value) { |
| 716 | mode_ = value; |
| 717 | return *this; |
| 718 | } |
| 719 | PoolingDescriptor& set_window_height(int64 value) { |
| 720 | SetDim(&window_, DimIndex::Y, value); |
| 721 | return *this; |
| 722 | } |
| 723 | PoolingDescriptor& set_window_width(int64 value) { |
| 724 | SetDim(&window_, DimIndex::X, value); |
| 725 | return *this; |
| 726 | } |
| 727 | PoolingDescriptor& set_window(DimIndex dim, int64 value) { |
| 728 | SetDim(&window_, dim, value); |
| 729 | return *this; |
| 730 | } |
| 731 | PoolingDescriptor& set_vertical_padding(int64 value) { |
| 732 | SetDim(&padding_, DimIndex::Y, value); |
| 733 | return *this; |
| 734 | } |
| 735 | PoolingDescriptor& set_horizontal_padding(int64 value) { |
| 736 | SetDim(&padding_, DimIndex::X, value); |
| 737 | return *this; |
| 738 | } |
| 739 | PoolingDescriptor& set_padding(DimIndex dim, int64 value) { |
| 740 | SetDim(&padding_, dim, value); |
| 741 | return *this; |
| 742 | } |
| 743 | PoolingDescriptor& set_vertical_stride(int64 value) { |
| 744 | SetDim(&strides_, DimIndex::Y, value); |
| 745 | return *this; |
| 746 | } |
| 747 | PoolingDescriptor& set_horizontal_stride(int64 value) { |
| 748 | SetDim(&strides_, DimIndex::X, value); |
| 749 | return *this; |
| 750 | } |
| 751 | PoolingDescriptor& set_stride(DimIndex dim, int64 value) { |
| 752 | SetDim(&strides_, dim, value); |
| 753 | return *this; |
| 754 | } |
| 755 | PoolingDescriptor& set_propagate_nans(bool value) { |
| 756 | propagate_nans_ = value; |
| 757 | return *this; |
| 758 | } |
| 759 | PoolingDescriptor& set_name(const string& name) { |
| 760 | name_ = name; |
| 761 | return *this; |
| 762 | } |
| 763 | |
| 764 | int ndims() const { return ndims_; } |
| 765 | void CloneFrom(const PoolingDescriptor& other); |
| 766 | |
| 767 | string ToString() const; |
no test coverage detected