提交 d1a69173 编写于 作者: G guosheng

fix bug on ClipLayer test in test_LayerGrad

上级 82911cec
...@@ -1907,8 +1907,10 @@ TEST(Layer, ClipLayer) { ...@@ -1907,8 +1907,10 @@ TEST(Layer, ClipLayer) {
config.inputDefs.push_back({INPUT_DATA, "input", size, 0}); config.inputDefs.push_back({INPUT_DATA, "input", size, 0});
LayerInputConfig* input = config.layerConfig.add_inputs(); LayerInputConfig* input = config.layerConfig.add_inputs();
ClipConfig* layerConf = input->mutable_clip_conf(); ClipConfig* layerConf = input->mutable_clip_conf();
layerConf->set_min(std::rand() / (double)RAND_MAX); double p1 = std::rand() / (double)RAND_MAX;
layerConf->set_max(std::rand() / (double)RAND_MAX); double p2 = std::rand() / (double)RAND_MAX;
layerConf->set_min(std::min(p1, p2));
layerConf->set_max(std::max(p1, p2));
for (auto useGpu : {false, true}) { for (auto useGpu : {false, true}) {
testLayerGrad(config, "clip", batchSize, false, useGpu, false); testLayerGrad(config, "clip", batchSize, false, useGpu, false);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册