@@ -53,7 +53,7 @@ class EltwiseLayerImpl : public EltwiseLayer
53
53
{
54
54
public:
55
55
EltwiseOp op;
56
- std::vector<int > coeffs;
56
+ std::vector<float > coeffs;
57
57
58
58
EltwiseLayerImpl (const LayerParams& params)
59
59
{
@@ -79,7 +79,7 @@ class EltwiseLayerImpl : public EltwiseLayer
79
79
coeffs.resize (n);
80
80
for (i = 0 ; i < n; i++)
81
81
{
82
- coeffs[i] = paramCoeff.get <int >(i);
82
+ coeffs[i] = paramCoeff.get <float >(i);
83
83
}
84
84
}
85
85
}
@@ -115,15 +115,15 @@ class EltwiseLayerImpl : public EltwiseLayer
115
115
const Mat** srcs;
116
116
int nsrcs;
117
117
Mat* dst;
118
- const std::vector<int >* coeffs;
118
+ const std::vector<float >* coeffs;
119
119
EltwiseOp op;
120
120
int nstripes;
121
121
const ActivationLayer* activ;
122
122
123
123
EltwiseInvoker () : srcs(0 ), nsrcs(0 ), dst(0 ), coeffs(0 ), op(EltwiseLayer::PROD), nstripes(0 ), activ(0 ) {}
124
124
125
125
static void run (const Mat** srcs, int nsrcs, Mat& dst,
126
- const std::vector<int >& coeffs, EltwiseOp op,
126
+ const std::vector<float >& coeffs, EltwiseOp op,
127
127
const ActivationLayer* activ, int nstripes)
128
128
{
129
129
CV_Assert (dst.dims == 4 && dst.type () == CV_32F && dst.isContinuous ());
@@ -143,7 +143,7 @@ class EltwiseLayerImpl : public EltwiseLayer
143
143
p.op = op;
144
144
p.nstripes = nstripes;
145
145
bool simpleCoeffs = true ;
146
- if ( op ! = EltwiseLayer::SUM && !coeffs.empty () )
146
+ if ( op = = EltwiseLayer::SUM && !coeffs.empty () )
147
147
{
148
148
CV_Assert ( coeffs.size () == (size_t )nsrcs );
149
149
@@ -169,7 +169,7 @@ class EltwiseLayerImpl : public EltwiseLayer
169
169
size_t stripeEnd = std::min (r.end *stripeSize, total);
170
170
int c, j, k, n = nsrcs;
171
171
int channels = dst->size [1 ];
172
- const int * coeffsptr = coeffs && !coeffs->empty () ? &coeffs->at (0 ) : 0 ;
172
+ const float * coeffsptr = coeffs && !coeffs->empty () ? &coeffs->at (0 ) : 0 ;
173
173
float * dstptr0 = dst->ptr <float >();
174
174
int blockSize0 = 1 << 12 , blockSize = blockSize0;
175
175
@@ -203,7 +203,7 @@ class EltwiseLayerImpl : public EltwiseLayer
203
203
{
204
204
for ( k = 1 ; k < n; k++ )
205
205
{
206
- const float * srcptr1 = srcs[0 ]->ptr <float >() + globalDelta;
206
+ const float * srcptr1 = srcs[k ]->ptr <float >() + globalDelta;
207
207
for ( j = 0 ; j < blockSize; j++ )
208
208
{
209
209
dstptr[j] = std::max (srcptr0[j], srcptr1[j]);
@@ -225,11 +225,11 @@ class EltwiseLayerImpl : public EltwiseLayer
225
225
}
226
226
else
227
227
{
228
- int c0 = coeffsptr[0 ];
228
+ float c0 = coeffsptr[0 ];
229
229
for ( k = 1 ; k < n; k++ )
230
230
{
231
231
const float * srcptr1 = srcs[k]->ptr <float >() + globalDelta;
232
- int c1 = coeffsptr[k];
232
+ float c1 = coeffsptr[k];
233
233
for ( j = 0 ; j < blockSize; j++ )
234
234
{
235
235
dstptr[j] = c0*srcptr0[j] + c1*srcptr1[j];
0 commit comments