提交 73dcf2cd 编写于 作者: H Haonan

improving code comments

上级 6245fed2
...@@ -38,7 +38,8 @@ void RotateLayer::forward(PassType passType) { ...@@ -38,7 +38,8 @@ void RotateLayer::forward(PassType passType) {
size_ = input->getWidth(); size_ = input->getWidth();
CHECK_GE(size_, height_ * width_); CHECK_GE(size_, height_ * width_);
CHECK_EQ(size_ % (height_ * width_), 0) CHECK_EQ(size_ % (height_ * width_), 0)
<< "The input's depth should be an int"; << "total size_ is not dividable by (height_ * width_), i.e., "
<< "channel number should be an integer";
channels_ = size_ / (height_ * width_); channels_ = size_ / (height_ * width_);
resizeOutput(batchSize_, size_); resizeOutput(batchSize_, size_);
......
...@@ -21,7 +21,7 @@ namespace paddle { ...@@ -21,7 +21,7 @@ namespace paddle {
/** /**
* A layer for rotating a multi-channel feature map (M x N x C) in the spatial * A layer for rotating a multi-channel feature map (M x N x C) in the spatial
* domain * domain
* The rotation is 90 degrees in clock-wise * The rotation is 90 degrees in clock-wise for each channel
* \f[ * \f[
* y(j,i,:) = x(M-i-1,j,:) * y(j,i,:) = x(M-i-1,j,:)
* \f] * \f]
......
...@@ -1320,9 +1320,10 @@ TEST(Layer, RotateLayer) { ...@@ -1320,9 +1320,10 @@ TEST(Layer, RotateLayer) {
TestConfig config; TestConfig config;
config.biasSize = 0; config.biasSize = 0;
config.layerConfig.set_type("rotate"); config.layerConfig.set_type("rotate");
const int INPUT_SIZE = 64; // height * width * depth const int CHANNEL = 2;
const int HEIGHT = 8; const int HEIGHT = 8;
const int WIDTH = 4; const int WIDTH = 4;
const int INPUT_SIZE = HEIGHT * WIDTH * CHANNEL;
config.layerConfig.set_size(INPUT_SIZE); config.layerConfig.set_size(INPUT_SIZE);
config.layerConfig.set_height(HEIGHT); config.layerConfig.set_height(HEIGHT);
config.layerConfig.set_width(WIDTH); config.layerConfig.set_width(WIDTH);
......
...@@ -1679,8 +1679,8 @@ def trans_layer(input, name=None, layer_attr=None): ...@@ -1679,8 +1679,8 @@ def trans_layer(input, name=None, layer_attr=None):
@layer_support() @layer_support()
def rotate_layer(input, height, width, name=None, layer_attr=None): def rotate_layer(input, height, width, name=None, layer_attr=None):
""" """
A layer for rotating 90 degrees (clock-wise), usually used when the input sample A layer for rotating 90 degrees (clock-wise) for each feature channel,
is some image or feature map. usually used when the input sample is some image or feature map.
.. math:: .. math::
y(j,i,:) = x(M-i-1,j,:) y(j,i,:) = x(M-i-1,j,:)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册