MemoryError:无法为形状(802、842、1502)和数据类型float32的数组分配3.78 GiB

时间:2020-03-06 12:19:31

标签: python numpy out-of-memory

我有一个想要操纵的大型仿真结果。

现在,由于python停止并告诉我,看来我的计算机无法处理太多了

declare
   altersystem       varchar2(550);
   altersystemconcat varchar2(550);
begin
   select grantee
     into altersystem
     from dba_sys_privs
    where privilege = 'ALTER SYSTEM'
      and grantee not in ('SYS', 'SYSTEM');
   if altersystem = 'No rows selected'
   then
      insert into catch
      values
         ('900'
         ,'No custom users with the Alter System privilege.');
   else
      select concat('The following user/role has the Alter System privilege, revoke if not required: '
                   ,altersystem)
        into altersystemconcat
        from dual;
      insert into catch
      values
         ('100'
         ,altersystemconcat);
   end if;
end;
/

和数据类型MemoryError: Unable to allocate 3.78 GiB for an array with shape (802, 842, 1502)

我无法更改/ proc / sys / vm / overcommit_memory,因为即使使用“ sudo”,该权限也被拒绝。

所以,我考虑降低数组中数字的精度,因为精度在仿真过程中对于避免累积误差很重要,但事后却没有那么重要。

假设我们将数组命名为float32

A

但是显然,要执行此操作,您需要操纵A = np.float16(A) (它仍然位于A中),并且会产生相同的错误。

那么...还有更好的主意吗?

0 个答案:

没有答案