Fix max elem (remove thrust) for segmentation
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
This commit is contained in:
committed by
Harshvardhan Chandirasekar
parent
19b1d6d6f7
commit
33bbcd216c
@@ -46,11 +46,16 @@ void maxElem_kernel(float *src_begin, float *dst_begin, const int n_classes, con
|
|||||||
if (i > size)
|
if (i > size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
thrust::device_ptr<float> dPbeg ( &src_begin[i*n_classes] ) ;
|
float max = 0;
|
||||||
thrust::device_ptr<float> dPend = dPbeg + n_classes;
|
int max_idx = 0;
|
||||||
thrust::device_ptr<float> result = thrust::max_element(thrust::device,dPbeg, dPend);
|
for( int j = i*n_classes; j < i*n_classes + n_classes; ++j ){
|
||||||
|
if( src_begin[j] > max ){
|
||||||
|
max = src_begin[j];
|
||||||
|
max_idx = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dst_begin[i] = result - dPbeg;
|
dst_begin[i] = max_idx - i*n_classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void maxElem(dnnType *src_begin, dnnType *dst_begin, const int c, const int h, const int w){
|
void maxElem(dnnType *src_begin, dnnType *dst_begin, const int c, const int h, const int w){
|
||||||
|
|||||||
Reference in New Issue
Block a user