Describes a convolution. Uses the named argument construction form: ConvolutionDescriptor convolution_dimensions; convolution_dimensions .set_vertical_filter_stride(2) .set_horizontal_filter_stride(2) ... Arguments: - zero_padding_height: padding of the "y dimension" of the input data. Note that this is different from the height of the filter. - zero_padding_width: analogous to the height above
| 555 | // rotating the filter by 180 degrees (or equivalently flipping all spatial |
| 556 | // dimensions). |
| 557 | class ConvolutionDescriptor { |
| 558 | public: |
| 559 | // By default construction, there is no zero-padding and the filter stride is |
| 560 | // 1x1 (centering the filter on every cell in the input layer's |
| 561 | // width-by-height area). |
| 562 | ConvolutionDescriptor(); |
| 563 | explicit ConvolutionDescriptor(int ndims); |
| 564 | ~ConvolutionDescriptor(); |
| 565 | |
| 566 | string ToString() const; |
| 567 | string ToShortString() const; |
| 568 | ConvolutionDescriptorProto ToProto() const { return proto_; } |
| 569 | |
| 570 | ConvolutionDescriptor& set_zero_padding_height(int64 value) { |
| 571 | SetDim(padding(), DimIndex::Y, value); |
| 572 | return *this; |
| 573 | } |
| 574 | ConvolutionDescriptor& set_zero_padding_width(int64 value) { |
| 575 | SetDim(padding(), DimIndex::X, value); |
| 576 | return *this; |
| 577 | } |
| 578 | ConvolutionDescriptor& set_zero_padding(DimIndex dim, int64 value) { |
| 579 | SetDim(padding(), dim, value); |
| 580 | return *this; |
| 581 | } |
| 582 | ConvolutionDescriptor& set_vertical_filter_stride(int64 value) { |
| 583 | SetDim(strides(), DimIndex::Y, value); |
| 584 | return *this; |
| 585 | } |
| 586 | ConvolutionDescriptor& set_horizontal_filter_stride(int64 value) { |
| 587 | SetDim(strides(), DimIndex::X, value); |
| 588 | return *this; |
| 589 | } |
| 590 | ConvolutionDescriptor& set_filter_stride(DimIndex dim, int64 value) { |
| 591 | SetDim(strides(), dim, value); |
| 592 | return *this; |
| 593 | } |
| 594 | ConvolutionDescriptor& set_vertical_dilation_rate(int64 value) { |
| 595 | SetDim(dilations(), DimIndex::Y, value); |
| 596 | return *this; |
| 597 | } |
| 598 | ConvolutionDescriptor& set_horizontal_dilation_rate(int64 value) { |
| 599 | SetDim(dilations(), DimIndex::X, value); |
| 600 | return *this; |
| 601 | } |
| 602 | ConvolutionDescriptor& set_dilation_rate(DimIndex dim, int64 value) { |
| 603 | SetDim(dilations(), dim, value); |
| 604 | return *this; |
| 605 | } |
| 606 | ConvolutionDescriptor& set_group_count(int group_count) { |
| 607 | proto_.set_group_count(group_count); |
| 608 | return *this; |
| 609 | } |
| 610 | ConvolutionDescriptor& set_convolution_not_crosscorr(bool conv) { |
| 611 | proto_.set_convolution_mode(conv ? ConvolutionMode::CONVOLUTION |
| 612 | : ConvolutionMode::CROSS_CORRELATION); |
| 613 | return *this; |
| 614 | } |
no test coverage detected