- Home
- :
- i.MX Forums
- :
- i.MX RT
- :
- Vec_reluf gives unexpected result

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Vec_reluf gives unexpected result

09-03-2020
08:54 AM

72 Views

Totovai

Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Hi, I am trying to make the function *vec_reluf* working from naturedsp_hifi4.

I've made a simple test

```
float32_t testIn[5] = {-1.0f, 2.3f, 3.0f, -4.4f, 2000.0f};
float32_t testOut[5] ={0};
vec_reluf(testOut, testIn, 1000.0f, 5);
```

the *expected* behavior is to obtain:

testOut={0, 2.3, 3, 0, 1000}

but the result is:

testOut = {0, 1.40129846e-45, 1.40129846e-45, 0 , 1.40129846e-45}

here is the function:

```
void vec_reluf (float32_t * y, const float32_t * x, float32_t K, int N)
{
ae_valign aY;
const xtfloatx2* restrict pX=(const xtfloatx2*)x;
xtfloatx2* restrict pY=( xtfloatx2*)y;
xtfloatx2 zero=XT_CONST_S(0);
int n;
if (N<=0) return;
if (((uintptr_t)pX)&7)
{
xtfloat t;
XT_LSIP(t,castxcc(xtfloat,pX),sizeof(xtfloat));
t=XT_MIN_S(K,t);
t=XT_MAX_S(t,zero);
XT_SSIP(t,castxcc(xtfloat,pY),sizeof(xtfloat));
N--;
}
aY=AE_ZALIGN64();
for(n=0; n<(N>>1); n++)
{
xtfloatx2 t;
XT_LSX2IP(t,pX,sizeof(xtfloatx2));
t=XT_MIN_SX2(K,t);
t=XT_MAX_SX2(t,zero);
XT_SASX2IP(t,aY,pY);
}
AE_SA64POS_FP(aY,pY);
if(N&1)
{
xtfloat t;
t=XT_LSI((const xtfloat*)pX,0);
t=XT_MIN_S(K,t);
t=XT_MAX_S(t,zero);
XT_SSI(t,(xtfloat*)pY,0);
}
}
```

Any suggestion?

Thx, Thomas

2 Replies

09-07-2020
08:35 AM

49 Views

nxf51209

NXP TechSupport

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Hello Thomas,

Hope you are doing well.

Could you please tell me which version of the SDK you are working with. Also I am unable to find the code you have posted. I do see the NatureDSP_Signal_math.h which includes this definition but not the full function. I'd like to verify that I am also seeing the same on my end and can reproduce this behavior.

Best Regards,

Sabina

Friday

3 Views

Totovai

Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Hi Sabina,

Thank you to take the time to answer me, the problem has disappeared one morning after a restart of the computer. I am not sure the restart has solved this but I cannot reproduce the problem.

Just in case, hereafter the information asked:

- SDK_2.8.0_EVK-MIMXRT685
- the function is in naturedsp_hifi4/mathhf/vec_relu_hifi4.c

Best regards,

Thomas