diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-08-19 18:11:35 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-08-19 18:11:35 +0100 |
commit | 50a60a54fd4dd9cab1a520b4bf1b54c1dd206f56 (patch) | |
tree | d456ae4a680cd922289031ceed3d3c73b3272d4c /src | |
parent | 2549b7686d660e35ad46c0eb4acf736272f862a1 (diff) | |
download | rspamd-50a60a54fd4dd9cab1a520b4bf1b54c1dd206f56.tar.gz rspamd-50a60a54fd4dd9cab1a520b4bf1b54c1dd206f56.zip |
[Minor] Fix tensor projections multiplication
Diffstat (limited to 'src')
-rw-r--r-- | src/lua/lua_tensor.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lua/lua_tensor.c b/src/lua/lua_tensor.c index 252c9ab92..6e5bec7d8 100644 --- a/src/lua/lua_tensor.c +++ b/src/lua/lua_tensor.c @@ -60,6 +60,7 @@ lua_newtensor (lua_State *L, int ndims, const int *dim, bool zero_fill, bool own struct rspamd_lua_tensor *res; res = lua_newuserdata (L, sizeof (struct rspamd_lua_tensor)); + memset (res, 0, sizeof (*res)); res->ndims = ndims; res->size = 1; @@ -453,10 +454,10 @@ lua_tensor_mul (lua_State *L) if (t1 && t2) { gint dims[2], shadow_dims[2]; - dims[0] = transA ? t1->dim[1] : t1->dim[0]; - shadow_dims[0] = transB ? t2->dim[1] : t2->dim[0]; - dims[1] = transB ? t2->dim[0] : t2->dim[1]; - shadow_dims[1] = transA ? t1->dim[0] : t1->dim[1]; + dims[0] = abs (transA ? t1->dim[1] : t1->dim[0]); + shadow_dims[0] = abs (transB ? t2->dim[1] : t2->dim[0]); + dims[1] = abs (transB ? t2->dim[0] : t2->dim[1]); + shadow_dims[1] = abs (transA ? t1->dim[0] : t1->dim[1]); if (shadow_dims[0] != shadow_dims[1]) { return luaL_error (L, "incompatible dimensions %d x %d * %d x %d", |