torch.utils#
创建日期: 2023年7月21日 | 最后更新日期: 2025年12月5日
重命名 privateuse1 后端设备,使其在 PyTorch API 中作为设备名称更方便使用。 |
|
在重命名 privateuse1 后端后,自动为自定义后端生成属性和方法。 |
|
返回一个包含当前线程 C++ 调用堆栈的字符串。 |
|
为给定对象设置 python 对象的 module 属性,以便更方便地打印。 |
|
此函数交换两个 Tensor 对象的内容。 |
torch.utils.collect_env#
torch.utils.flop_counter#
计算 baddbmm 操作的浮点运算次数。 |
|
计算 bmm 操作的浮点运算次数。 |
|
计算卷积的浮点运算次数。 |
|
计算卷积的浮点运算次数。 |
|
计算自注意力后向传播的浮点运算次数。 |
|
计算自注意力的浮点运算次数。 |
|
计算自注意力的浮点运算次数。 |
|
torch.utils.hipify.hipify_python#
Python Hipify 脚本。 ## # Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. # 2017-2018 Advanced Micro Devices, Inc. and # Facebook Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE。
返回即将到来的函数参数闭包中的参数列表。 |
|
查找第一个平衡的括号。 |
|
查找平衡闭包组的通用方法 |
|
查找第一个平衡的方括号。 |
|
HIP 中的静态全局内核会导致编译错误。 |
|
如果文件进行了内核内置函数调用但未包含 cuda_runtime.h 头文件,则会自动添加一个 #include 以匹配 NVCC 提供的“magic” include。 |
|
对指定文件执行 CUDA -> HIP 转换。 |
|
将 CUDA 风格的内核启动替换为 HIP 风格的内核启动。 |
|
匹配 'extern __shared__ type foo[];' 语法,并使用 HIP_DYNAMIC_SHARED() MACRO 代替。 |
|
FIXME: 暂时替换 std:: 对数学函数的调用为非 std:: 版本,以防止链接器错误。注意:这可能会导致运行测试时出现正确性问题,因为可能不会调用正确的数学函数版本(exp/expf)。 |
|
ArgumentParser 不支持 type=bool。 |