Maybe I found a bug in ocrolib/nutils.py.

The function to be compiled and used during training:

void sumprod(int r,int n,double u[r][n],double v[r][n],double a[n]) {
    for(int i=0;i<n;i++) {
        double total = 0.0;
        for(int k=0;k<r;k++) total += u[k][i]*v[k][i];
        a[i] = total;
    }
}

Python wrapper:

lstm_native.sumprod.argtypes = [I,I,A1D,A2D,A2D]
def sumprod(u,v,out=None):
    assert out.shape==u.shape[1:] and out.shape==v.shape[1:] and 
u.shape[:1]==v.shape[:1]
    lstm_native.sumprod(len(u),len(out),out,u,v)
    return out

But I think the Python wrapper should be

lstm_native.sumprod.argtypes = [I,I,A2D,A2D,A1D]
def sumprod(u,v,out=None):
    assert out.shape==u.shape[1:] and out.shape==v.shape[1:] and 
u.shape[:1]==v.shape[:1]
    lstm_native.sumprod(len(u),len(out),u,v,out)
    return out

This made my training process crash. And even if it does not crash, it 
should lead to wrong results, shouldn't it?

Regards

-- 
You received this message because you are subscribed to the Google Groups 
"ocropus" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ocropus/3af34781-8aec-4c61-a1b2-79ae67c1072e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to