update ffi to be consistent with torch