|
|
|
@ -27,15 +27,19 @@ TEST(CrossMapNormal, real) {
|
|
|
|
|
<< " imgSizeH=" << imgSizeH << " imgSizeW=" << imgSizeW
|
|
|
|
|
<< " size=" << size;
|
|
|
|
|
|
|
|
|
|
FunctionCompare compare("CrossMapNormal",
|
|
|
|
|
FuncConfig()
|
|
|
|
|
.set("size", size)
|
|
|
|
|
.set("scale", (real)1.5)
|
|
|
|
|
.set("pow", (real)0.5));
|
|
|
|
|
Dims dims{numSamples, channels, imgSizeH, imgSizeW};
|
|
|
|
|
compare.cmpWithArg({Tensor(nullptr, dims)},
|
|
|
|
|
{Tensor(nullptr, dims), Tensor(nullptr, dims)},
|
|
|
|
|
{});
|
|
|
|
|
// init Test object
|
|
|
|
|
FunctionCompare test("CrossMapNormal",
|
|
|
|
|
FuncConfig()
|
|
|
|
|
.set("size", size)
|
|
|
|
|
.set("scale", (real)1.5)
|
|
|
|
|
.set("pow", (real)0.5));
|
|
|
|
|
// prepare input arguments
|
|
|
|
|
TensorShape shape{numSamples, channels, imgSizeH, imgSizeW};
|
|
|
|
|
test.addInputs(BufferArg(VALUE_TYPE_FLOAT, shape));
|
|
|
|
|
test.addOutputs(BufferArg(VALUE_TYPE_FLOAT, shape));
|
|
|
|
|
test.addOutputs(BufferArg(VALUE_TYPE_FLOAT, shape));
|
|
|
|
|
// run Function
|
|
|
|
|
test.run();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -43,6 +47,9 @@ TEST(CrossMapNormal, real) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
// TODO(hedaoyuan): Now CrossMapNormalGrad not support ASSIGN_TO mode.
|
|
|
|
|
// Maybe all Function need support ASSIGN_TO mode.
|
|
|
|
|
TEST(CrossMapNormalGrad, real) {
|
|
|
|
|
for (size_t numSamples : {5, 32}) {
|
|
|
|
|
for (size_t channels : {1, 5, 32}) {
|
|
|
|
@ -53,23 +60,25 @@ TEST(CrossMapNormalGrad, real) {
|
|
|
|
|
<< " imgSizeH=" << imgSizeH << " imgSizeW=" << imgSizeW
|
|
|
|
|
<< " size=" << size;
|
|
|
|
|
|
|
|
|
|
FunctionCompare compare("CrossMapNormalGrad",
|
|
|
|
|
FuncConfig()
|
|
|
|
|
.set("size", size)
|
|
|
|
|
.set("scale", (real)1.5)
|
|
|
|
|
.set("pow", (real)0.5));
|
|
|
|
|
Dims dims{numSamples, channels, imgSizeH, imgSizeW};
|
|
|
|
|
compare.cmpWithArg({Tensor(nullptr, dims),
|
|
|
|
|
Tensor(nullptr, dims),
|
|
|
|
|
Tensor(nullptr, dims),
|
|
|
|
|
Tensor(nullptr, dims)},
|
|
|
|
|
{Tensor(nullptr, dims)},
|
|
|
|
|
{});
|
|
|
|
|
FunctionCompare test("CrossMapNormalGrad",
|
|
|
|
|
FuncConfig()
|
|
|
|
|
.set("size", size)
|
|
|
|
|
.set("scale", (real)1.5)
|
|
|
|
|
.set("pow", (real)0.5));
|
|
|
|
|
TensorShape shape{numSamples, channels, imgSizeH, imgSizeW};
|
|
|
|
|
test.addInputs(BufferArg(VALUE_TYPE_FLOAT, shape));
|
|
|
|
|
test.addInputs(BufferArg(VALUE_TYPE_FLOAT, shape));
|
|
|
|
|
test.addInputs(BufferArg(VALUE_TYPE_FLOAT, shape));
|
|
|
|
|
test.addInputs(BufferArg(VALUE_TYPE_FLOAT, shape));
|
|
|
|
|
test.addOutputs(BufferArg(VALUE_TYPE_FLOAT, shape));
|
|
|
|
|
// run Function
|
|
|
|
|
test.run();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
} // namespace paddle
|
|
|
|
|