New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
paddle.randn输入float类型导致内存溢出问题 #35669
Comments
您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档、常见问题、历史Issue、AI社区来寻求解答。祝您生活愉快~ Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the API,FAQ,Github Issue and AI community to get the answer.Have a nice day! |
可以试试自行编一个 develop 的版本,报错信息已经更新。
|
import paddle
tensor = paddle.randn((2*16, 640*640/16, 128)) 函数 paddle.randn(shape, dtype=None, name=None) 其中对
就是说要求 paddle.fluid.framework.in_dygraph_mode() == True 不会做任何 # NOTE [ Why skip dynamic graph check ]:
# 1. If the input type / dtype of a layer is wrong, it will be reported
# directly on that line. User can easily print the relevant information
# on which line. It is easier to debug, so there is no need to check
# in dynamic graph mode.
# 2. Performance considerations. Because these checks are executed at
# each step in dynamic graph mode, it will bring a heavy performance burden. 在动态图模式下, if in_dygraph_mode():
shape = utils.convert_shape_to_list(shape)
return _C_ops.gaussian_random('shape', shape, 'mean',
float(mean), 'std',
float(std), 'seed', seed, 'dtype', dtype) 在调用 def convert_shape_to_list(shape):
"""
Convert shape(list, tuple, variable) to list in imperative mode
"""
if isinstance(shape, (list, tuple)):
shape = list(
map(lambda x: x.numpy()[0] if isinstance(x, Variable) else x,
shape))
else:
shape = shape.numpy().astype(int).tolist()
return shape 也就是说,这里的 |
python调用_C_ops.xxx的代码是自动生成出来的,自动生成代码在如下文件中: 如果你用develop自己编译,编译完成后可以找到一个文件:paddle/fluid/pybind/op_function_impl.h,gaussian_random定义在这个文件中。 |
好哒,谢谢啦!我试一下~ |
paddle version: 2.1.2
import paddle paddle.randn((2*16, 640*640/16, 128))
第二个参数会是浮点数,会报以下错误:
SystemError: (Fatal) Operator gaussian_random raises an struct paddle::memory::allocation::BadAlloc exception.
The exception content is
:ResourceExhaustedError:
Out of memory error on GPU 0. Cannot allocate 400.000244MB memory on GPU 0, 2.361126GB memory has been allocated and available memory is only 3.638874GB.
Please check whether there is any other process using GPU 0.
(at C:\home\workspace\Paddle_release3\paddle\fluid\memory\allocation\cuda_allocator.cc:79)
. (at C:\home\workspace\Paddle_release3\paddle\fluid\imperative\tracer.cc:192)
放在cpu上依然不会抛出类型错误,只会出现bad alloc
The text was updated successfully, but these errors were encountered: