mindspore.runtime.use_mem_pool =============================== .. image:: https://mindspore-website.obs.cn-north-4.myhuaweicloud.com/website-images/br_base/resource/_static/logo_source.svg :target: https://gitee.com/mindspore/mindspore/blob/br_base/docs/api/api_python/runtime/mindspore.runtime.use_mem_pool.rst :alt: 查看源文件 .. py:function:: mindspore.runtime.use_mem_pool(pool: MemPool) 将内存分配和释放操作路由到指定内存池的上下文管理器。 .. note:: - 该上下文管理器仅会使当前线程的内存分配操作路由到指定内存池。 - 若在上下文管理器内部创建新线程,该线程的内存分配将不会路由到指定内存池。 - 只有在上下文管理器内部分配Device内存,才能将分配操作路由到指定内存池。 参数: - **pool** (mindspore.runtime.MemPool) - 封装了PluggableAllocator的MemPool对象。