Skip to content

Commit 73dcf2c

Browse files
author
Haonan
committed
improving code comments
1 parent 6245fed commit 73dcf2c

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

paddle/gserver/layers/RotateLayer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ void RotateLayer::forward(PassType passType) {
3838
size_ = input->getWidth();
3939
CHECK_GE(size_, height_ * width_);
4040
CHECK_EQ(size_ % (height_ * width_), 0)
41-
<< "The input's depth should be an int";
41+
<< "total size_ is not dividable by (height_ * width_), i.e., "
42+
<< "channel number should be an integer";
4243
channels_ = size_ / (height_ * width_);
4344

4445
resizeOutput(batchSize_, size_);

paddle/gserver/layers/RotateLayer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace paddle {
2121
/**
2222
* A layer for rotating a multi-channel feature map (M x N x C) in the spatial
2323
* domain
24-
* The rotation is 90 degrees in clock-wise
24+
* The rotation is 90 degrees in clock-wise for each channel
2525
* \f[
2626
* y(j,i,:) = x(M-i-1,j,:)
2727
* \f]

paddle/gserver/tests/test_LayerGrad.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,9 +1320,10 @@ TEST(Layer, RotateLayer) {
13201320
TestConfig config;
13211321
config.biasSize = 0;
13221322
config.layerConfig.set_type("rotate");
1323-
const int INPUT_SIZE = 64; // height * width * depth
1323+
const int CHANNEL = 2;
13241324
const int HEIGHT = 8;
13251325
const int WIDTH = 4;
1326+
const int INPUT_SIZE = HEIGHT * WIDTH * CHANNEL;
13261327
config.layerConfig.set_size(INPUT_SIZE);
13271328
config.layerConfig.set_height(HEIGHT);
13281329
config.layerConfig.set_width(WIDTH);

python/paddle/trainer_config_helpers/layers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,8 +1679,8 @@ def trans_layer(input, name=None, layer_attr=None):
16791679
@layer_support()
16801680
def rotate_layer(input, height, width, name=None, layer_attr=None):
16811681
"""
1682-
A layer for rotating 90 degrees (clock-wise), usually used when the input sample
1683-
is some image or feature map.
1682+
A layer for rotating 90 degrees (clock-wise) for each feature channel,
1683+
usually used when the input sample is some image or feature map.
16841684
16851685
.. math::
16861686
y(j,i,:) = x(M-i-1,j,:)

0 commit comments

Comments
 (0)