fix bug of deformable_offsets_grad
This commit is contained in:
parent
ede1016272
commit
c3a3eb1a7f
|
@ -107,8 +107,8 @@ struct OffsetIndex {
|
|||
};
|
||||
|
||||
struct InputXIndex {
|
||||
size_t i;
|
||||
size_t j;
|
||||
float i;
|
||||
float j;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
@ -141,10 +141,10 @@ inline std::tuple<size_t, size_t, size_t> CalPosition(const OffsetIndex &offset_
|
|||
|
||||
inline InputXIndex CalInputXIndex(const OffsetIndex &offset_index, const DeformableOffsetGradDims &dims) {
|
||||
InputXIndex input_x_index;
|
||||
input_x_index.i = dims.pad_top;
|
||||
input_x_index.j = dims.pad_left;
|
||||
input_x_index.i += offset_index.offset_i * dims.stride_h + offset_index.kernel_i * dims.dilation_h;
|
||||
input_x_index.j += offset_index.offset_j * dims.stride_w + offset_index.kernel_j * dims.dilation_w;
|
||||
input_x_index.i = -1.0 * SizeToFloat(dims.pad_top);
|
||||
input_x_index.j = -1.0 * SizeToFloat(dims.pad_left);
|
||||
input_x_index.i += SizeToFloat(offset_index.offset_i * dims.stride_h + offset_index.kernel_i * dims.dilation_h);
|
||||
input_x_index.j += SizeToFloat(offset_index.offset_j * dims.stride_w + offset_index.kernel_j * dims.dilation_w);
|
||||
return input_x_index;
|
||||
}
|
||||
|
||||
|
@ -167,10 +167,10 @@ void DeformableOffsetGradKernel(const OffsetIndex &offset_index, const OffsetStr
|
|||
float ceil_offset_i = floor_offset_i + 1;
|
||||
float ceil_offset_j = floor_offset_j + 1;
|
||||
|
||||
float floor_i = SizeToFloat(input_x_index.i) + floor_offset_i;
|
||||
float floor_j = SizeToFloat(input_x_index.j) + floor_offset_j;
|
||||
float ceil_i = SizeToFloat(input_x_index.i) + ceil_offset_i;
|
||||
float ceil_j = SizeToFloat(input_x_index.j) + ceil_offset_j;
|
||||
float floor_i = input_x_index.i + floor_offset_i;
|
||||
float floor_j = input_x_index.j + floor_offset_j;
|
||||
float ceil_i = input_x_index.i + ceil_offset_i;
|
||||
float ceil_j = input_x_index.j + ceil_offset_j;
|
||||
|
||||
float ceil_weight_i = offset_i + 1 - ceil_offset_i;
|
||||
float ceil_weight_j = offset_j + 1 - ceil_offset_j;
|
||||
|
|
Loading…
Reference in New Issue