Add ScaleSubRegion Layer.#5488
Conversation
| * input_1: Indices value to specify the location an shape of the | ||
| * region. | ||
| */ | ||
| class MulValueLayer : public Layer { |
There was a problem hiding this comment.
MulValueLayer 会不会让人产生误解?ScaleLayer ? SubScaleLayer?
There was a problem hiding this comment.
Changed to ScaleSubRegionLayer.
paddle/function/MulValueOpTest.cpp
Outdated
| << " channels=" << channels << " imgSizeH=" << imgSizeH | ||
| << " imgSizeW=" << imgSizeW; | ||
|
|
||
| for (bool test_grad : {false}) { |
There was a problem hiding this comment.
test_grad -> testGrad, 和前边变量保持一致?
paddle/function/MulValueOpTest.cpp
Outdated
| << " channels=" << channels << " imgSizeH=" << imgSizeH | ||
| << " imgSizeW=" << imgSizeW; | ||
|
|
||
| for (bool test_grad : {false}) { |
| } | ||
|
|
||
| if (initArgsCallback_ != nullptr) { | ||
| initArgsCallback_(*func1Inputs_[i], i); |
There was a problem hiding this comment.
如果input[1]的初始化依赖input[0],怎么办?把initArgsCallback_放到循环外,整个func1Inputs_作为参数,会不会更灵活些?
There was a problem hiding this comment.
Callback的场景比较有限,如果出现你说的情况,可以到时再考虑扩展
paddle/function/MulValueOpTest.cpp
Outdated
|
|
||
| for (size_t i = 0; i < numSamples; ++i) { | ||
| size_t offset = i * 6; | ||
| data[offset] = firstHalf ? 1 : (int)channels / 2; |
| channelsNum_ = imgV->getWidth() / spatialSize; | ||
| shape_ = TensorShape({batchSize, channelsNum_, imgH_, imgW_}); | ||
|
|
||
| resetOutput(batchSize, imgV->getWidth()); |
There was a problem hiding this comment.
是不是应该设置下output 的 FrameHeight 和 FrameWidth? 下个layer有可能用到。
qingqing01
left a comment
There was a problem hiding this comment.
paddle/gserver/layers/MulValueLayer.h
paddle/gserver/layers/MulValueLayer.cpp
没有删除。
paddle/function/MulValueOp.cpp
Outdated
| namespace paddle { | ||
|
|
||
| template <> | ||
| void MulValue<DEVICE_TYPE_CPU>(real* outputs, |
There was a problem hiding this comment.
MulValue -> ScaleSubRegion ?
paddle/function/MulValueOpTest.cpp
Outdated
| for (size_t numSamples : {5, 32}) { | ||
| for (size_t channels : {5, 5, 32}) { | ||
| for (size_t imgSizeH : {5, 33, 100}) { | ||
| for (size_t imgSizeW : {5, 32, 96}) { |
There was a problem hiding this comment.
减少channels,imgSizeH,imgSizeW遍历吧, 减少for循环的次数,减少单测时间。
Resolves #5416