register_external_allocator
功能说明
用户将自己的Allocator注册给GE,适用于使用用户的内存池场景。
函数原型
1 | register_external_allocator(stream: int, allocator: Allocator) -> None |
参数说明
参数名 |
输入/输出 |
描述 |
|---|---|---|
stream |
输入 |
指定Allocator注册在哪个Stream上。 |
allocator |
输入 |
用户Allocator对象。Allocator基于Allocator派生 |
返回值说明
无
约束说明
- 如果stream不是整数,抛出TypeError。
- 如果allocator不是Allocator对象,抛出TypeError。
- 如果注册失败,抛出RuntimeError。
父主题: Session接口