提交 cb6cc5a9 编写于 作者: T typhoonzero

Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into clusterdesign

...@@ -56,7 +56,14 @@ void TransLayer::backward(const UpdateCallback& callback) { ...@@ -56,7 +56,14 @@ void TransLayer::backward(const UpdateCallback& callback) {
return; return;
} }
MatrixPtr preGrad = getInputGrad(0); MatrixPtr preGrad = getInputGrad(0);
outputGrad->transpose(preGrad, false); if (preGrad) {
MatrixPtr transGrad = Matrix::create(preGrad->getHeight(),
preGrad->getWidth(),
/* trans= */ false,
preGrad->useGpu());
outputGrad->transpose(transGrad, false);
preGrad->add(*transGrad);
}
} }
} // namespace paddle } // namespace paddle
...@@ -1689,6 +1689,22 @@ TEST(Layer, smooth_l1) { ...@@ -1689,6 +1689,22 @@ TEST(Layer, smooth_l1) {
} }
} }
TEST(Layer, TransLayer) {
TestConfig config;
const int height = 128;
const int width = 1028;
config.layerConfig.set_type("trans");
config.layerConfig.set_size(width);
config.inputDefs.push_back(
{INPUT_DATA, "layer_0", /* dim= */ height * width, /* paraSize= */ 0});
config.layerConfig.add_inputs();
for (auto useGpu : {false, true}) {
testLayerGrad(config, "trans", height, /* trans= */ false, useGpu);
}
}
int main(int argc, char** argv) { int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
initMain(argc, argv); initMain(argc, argv);
......
...@@ -75,9 +75,8 @@ fi ...@@ -75,9 +75,8 @@ fi
paddle version paddle version
# generate production docker image Dockerfile if [[ -n ${APT_MIRROR} ]]; then
if [ ${USE_MIRROR} ]; then MIRROR_UPDATE="sed -i '${APT_MIRROR}' /etc/apt/sources.list && \\"
MIRROR_UPDATE="sed 's@http:\/\/archive.ubuntu.com\/ubuntu\/@mirror:\/\/mirrors.ubuntu.com\/mirrors.txt@' -i /etc/apt/sources.list && \\"
else else
MIRROR_UPDATE="\\" MIRROR_UPDATE="\\"
fi fi
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册