torch.utils#
Created On: Jul 21, 2023 | Last Updated On: May 12, 2026
Return a string containing the C++ stack trace of the current thread. |
|
Set the module attribute on a python object for a given object for nicer printing |
|
This function swaps the content of the two Tensor objects. |
torch.utils.backend_registration#
Automatically generate attributes and methods for the custom backend after rename privateuse1 backend. |
|
Rename the privateuse1 backend device to make it more convenient to use as a device name within PyTorch APIs. |
torch.utils.hooks#
torch.utils.throughput_benchmark#
torch.utils.collect_env#
Return (return-code, stdout, stderr). |
|
Run command using run_lambda, returns the first regex match if it exists. |
|
Run command using run_lambda; reads and returns entire output if rc is 0. |
|
Run command using run_lambda and returns first line if output is not empty. |
torch.utils.flop_counter#
Count flops for the baddbmm operation. |
|
Count flops for the bmm operation. |
|
Count flops for convolution. |
|
Count flops for convolution. |
|
Count flops for self-attention backward. |
|
Count flops for self-attention. |
|
Count flops for self-attention. |
|
torch.utils.hipify.hipify_python#
The Python Hipify script. ## # 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.
adds dim3() to the second and third arguments in the kernel launch |
|
Return the list of arguments in the upcoming function parameter closure. |
|
Finds the first balanced parentheses. |
|
Generalization for finding a balancing closure group |
|
Finds the first balanced bracket. |
|
Static global kernels in HIP results in a compilation error. |
|
Returns the new name of the hipified file |
|
If the file makes kernel builtin calls and does not include the cuda_runtime.h header, then automatically add an #include to match the "magic" includes provided by NVCC. |
|
Helper method to see if filename ends with certain extension |
|
Executes the CUDA -> HIP conversion on the specified file. |
|
Replace the CUDA style Kernel launches with the HIP style kernel launches. |
|
Match 'extern __shared__ type foo[];' syntax and use HIP_DYNAMIC_SHARED() MACRO instead. |
|
FIXME: Temporarily replace std:: invocations of math functions with non-std:: versions to prevent linker errors NOTE: This can lead to correctness issues when running tests, since the correct version of the math function (exp/expf) might not get called. |
|
ArgumentParser doesn't support type=bool. |
Wrapper around a weak ref of a Tensor that handles the _fix_weakref() call required when unwrapping a Tensor weakref. |