查看torch中的所有函数

简介: hspmmhstackhubhypoti0i0_igammaigammaciinfoimagimport_ir_moduleimport_ir_module_from_bufferindex_addindex_copyindex_fillindex_putindex_put_index_selectinit_num_t
import torch
s = dir(torch)
for i in s:
    print(i)


结果

AVG
AggregationType
AnyType
Argument
ArgumentSpec
BFloat16Storage
BFloat16Tensor
BenchmarkConfig
BenchmarkExecutionStats
Block
BoolStorage
BoolTensor
BoolType
BufferDict
ByteStorage
ByteTensor
CONV_BN_FUSION
CallStack
Capsule
CharStorage
CharTensor
ClassType
Code
CompilationUnit
CompleteArgumentSpec
ComplexDoubleStorage
ComplexFloatStorage
ComplexType
ConcreteModuleType
ConcreteModuleTypeBuilder
CudaBFloat16StorageBase
CudaBoolStorageBase
CudaByteStorageBase
CudaCharStorageBase
CudaComplexDoubleStorageBase
CudaComplexFloatStorageBase
CudaDoubleStorageBase
CudaFloatStorageBase
CudaHalfStorageBase
CudaIntStorageBase
CudaLongStorageBase
CudaShortStorageBase
DeepCopyMemoTable
DeviceObjType
DictType
DisableTorchFunction
DoubleStorage
DoubleTensor
EnumType
ErrorReport
ExecutionPlan
FUSE_ADD_RELU
FatalError
FileCheck
FloatStorage
FloatTensor
FloatType
FunctionSchema
Future
FutureType
Generator
Gradient
Graph
GraphExecutorState
HOIST_CONV_PACKED_PARAMS
HalfStorage
HalfStorageBase
HalfTensor
INSERT_FOLD_PREPACK_OPS
IODescriptor
InferredType
IntStorage
IntTensor
IntType
InterfaceType
JITException
ListType
LiteScriptModule
LockingLogger
LoggerBase
LongStorage
LongTensor
MobileOptimizerType
ModuleDict
Node
NoneType
NoopLogger
NumberType
OptionalType
ParameterDict
PyObjectType
PyTorchFileReader
PyTorchFileWriter
QInt32Storage
QInt32StorageBase
QInt8Storage
QInt8StorageBase
QUInt4x2Storage
QUInt8Storage
REMOVE_DROPOUT
RRefType
SUM
ScriptClass
ScriptFunction
ScriptMethod
ScriptModule
ScriptObject
Set
ShortStorage
ShortTensor
Size
StaticRuntime
Storage
Stream
StreamObjType
StringType
TYPE_CHECKING
Tensor
TensorType
ThroughputBenchmark
TracingState
TupleType
Type
USE_GLOBAL_DEPS
USE_RTLD_GLOBAL_WITH_LIBTORCH
Use
Value
_C
_StorageBase
_VF
__all__
__annotations__
__builtins__
__cached__
__config__
__doc__
__file__
__future__
__loader__
__name__
__package__
__path__
__spec__
__version__
_adaptive_avg_pool2d
_add_batch_dim
_add_relu
_add_relu_
_addmv_impl_
_aminmax
_amp_foreach_non_finite_check_and_unscale_
_amp_update_scale
_assert
_autograd_functions
_baddbmm_mkl_
_batch_norm_impl_index
_bmm
_cast_Byte
_cast_Char
_cast_Double
_cast_Float
_cast_Half
_cast_Int
_cast_Long
_cast_Short
_cat
_choose_qparams_per_tensor
_classes
_compute_linear_combination
_conj
_convolution
_convolution_nogroup
_copy_from
_ctc_loss
_cudnn_ctc_loss
_cudnn_init_dropout_state
_cudnn_rnn
_cudnn_rnn_flatten_weight
_cufft_clear_plan_cache
_cufft_get_plan_cache_max_size
_cufft_get_plan_cache_size
_cufft_set_plan_cache_max_size
_cummax_helper
_cummin_helper
_debug_has_internal_overlap
_dim_arange
_dirichlet_grad
_embedding_bag
_embedding_bag_forward_only
_empty_affine_quantized
_empty_per_channel_affine_quantized
_euclidean_dist
_fake_quantize_learnable_per_channel_affine
_fake_quantize_learnable_per_tensor_affine
_fft_c2c
_fft_c2r
_fft_r2c
_foreach_abs
_foreach_abs_
_foreach_acos
_foreach_acos_
_foreach_add
_foreach_add_
_foreach_addcdiv
_foreach_addcdiv_
_foreach_addcmul
_foreach_addcmul_
_foreach_asin
_foreach_asin_
_foreach_atan
_foreach_atan_
_foreach_ceil
_foreach_ceil_
_foreach_cos
_foreach_cos_
_foreach_cosh
_foreach_cosh_
_foreach_div
_foreach_div_
_foreach_erf
_foreach_erf_
_foreach_erfc
_foreach_erfc_
_foreach_exp
_foreach_exp_
_foreach_expm1
_foreach_expm1_
_foreach_floor
_foreach_floor_
_foreach_frac
_foreach_frac_
_foreach_lgamma
_foreach_lgamma_
_foreach_log
_foreach_log10
_foreach_log10_
_foreach_log1p
_foreach_log1p_
_foreach_log2
_foreach_log2_
_foreach_log_
_foreach_maximum
_foreach_minimum
_foreach_mul
_foreach_mul_
_foreach_neg
_foreach_neg_
_foreach_reciprocal
_foreach_reciprocal_
_foreach_round
_foreach_round_
_foreach_sigmoid
_foreach_sigmoid_
_foreach_sin
_foreach_sin_
_foreach_sinh
_foreach_sinh_
_foreach_sqrt
_foreach_sqrt_
_foreach_sub
_foreach_sub_
_foreach_tan
_foreach_tan_
_foreach_tanh
_foreach_tanh_
_foreach_trunc
_foreach_trunc_
_foreach_zero_
_fused_dropout
_grid_sampler_2d_cpu_fallback
_has_compatible_shallow_copy_type
_import_dotted_name
_index_copy_
_index_put_impl_
_initExtension
_jit_internal
_linalg_inv_out_helper_
_linalg_qr_helper
_linalg_solve_out_helper_
_linalg_utils
_load_global_deps
_lobpcg
_log_softmax
_log_softmax_backward_data
_logcumsumexp
_lowrank
_lu_solve_helper
_lu_with_info
_make_dual
_make_per_channel_quantized_tensor
_make_per_tensor_quantized_tensor
_masked_scale
_mkldnn
_mkldnn_reshape
_mkldnn_transpose
_mkldnn_transpose_
_mode
_namedtensor_internals
_nnpack_available
_nnpack_spatial_convolution
_ops
_pack_padded_sequence
_pad_packed_sequence
_remove_batch_dim
_reshape_from_tensor
_rowwise_prune
_s_where
_sample_dirichlet
_saturate_weight_to_fp16
_shape_as_tensor
_six
_sobol_engine_draw
_sobol_engine_ff_
_sobol_engine_initialize_state_
_sobol_engine_scramble_
_softmax
_softmax_backward_data
_sparse_addmm
_sparse_coo_tensor_unsafe
_sparse_log_softmax
_sparse_log_softmax_backward_data
_sparse_matrix_mask_helper
_sparse_mm
_sparse_softmax
_sparse_softmax_backward_data
_sparse_sparse_matmul
_sparse_sum
_stack
_standard_gamma
_standard_gamma_grad
_std
_storage_classes
_string_classes
_syevd_helper
_tensor_classes
_tensor_str
_test_serialization_subcmul
_trilinear
_unique
_unique2
_unpack_dual
_use_cudnn_ctc_loss
_use_cudnn_rnn_flatten_weight
_utils
_utils_internal
_validate_sparse_coo_tensor_args
_var
_vmap_internals
_weight_norm
_weight_norm_cuda_interface
abs
abs_
absolute
acos
acos_
acosh
acosh_
adaptive_avg_pool1d
adaptive_max_pool1d
add
addbmm
addcdiv
addcmul
addmm
addmv
addmv_
addr
affine_grid_generator
align_tensors
all
allclose
alpha_dropout
alpha_dropout_
amax
amin
angle
any
arange
arccos
arccos_
arccosh
arccosh_
arcsin
arcsin_
arcsinh
arcsinh_
arctan
arctan_
arctanh
arctanh_
are_deterministic_algorithms_enabled
argmax
argmin
argsort
as_strided
as_strided_
as_tensor
asin
asin_
asinh
asinh_
atan
atan2
atan_
atanh
atanh_
atleast_1d
atleast_2d
atleast_3d
autocast_decrement_nesting
autocast_increment_nesting
autograd
avg_pool1d
backends
baddbmm
bartlett_window
base_py_dll_path
batch_norm
batch_norm_backward_elemt
batch_norm_backward_reduce
batch_norm_elemt
batch_norm_gather_stats
batch_norm_gather_stats_with_counts
batch_norm_stats
batch_norm_update_stats
bernoulli
bfloat16
bilinear
binary_cross_entropy_with_logits
bincount
binomial
bitwise_and
bitwise_not
bitwise_or
bitwise_xor
blackman_window
block_diag
bmm
bool
broadcast_shapes
broadcast_tensors
broadcast_to
bucketize
can_cast
cartesian_prod
cat
cdist
cdouble
ceil
ceil_
celu
celu_
cfloat
chain_matmul
channel_shuffle
channels_last
channels_last_3d
cholesky
cholesky_inverse
cholesky_solve
choose_qparams_optimized
chunk
clamp
clamp_
clamp_max
clamp_max_
clamp_min
clamp_min_
classes
clear_autocast_cache
clip
clip_
clone
column_stack
combinations
compiled_with_cxx11_abi
complex
complex128
complex32
complex64
conj
constant_pad_nd
contiguous_format
conv1d
conv2d
conv3d
conv_tbc
conv_transpose1d
conv_transpose2d
conv_transpose3d
convolution
copysign
cos
cos_
cosh
cosh_
cosine_embedding_loss
cosine_similarity
count_nonzero
cpp
cross
ctc_loss
ctypes
cuda
cuda_path
cuda_version
cudnn_affine_grid_generator
cudnn_batch_norm
cudnn_convolution
cudnn_convolution_transpose
cudnn_grid_sampler
cudnn_is_acceptable
cummax
cummin
cumprod
cumsum
default_generator
deg2rad
deg2rad_
dequantize
det
detach
detach_
device
diag
diag_embed
diagflat
diagonal
diff
digamma
dist
distributed
distributions
div
divide
dll
dll_path
dll_paths
dlls
dot
double
dropout
dropout_
dsmm
dstack
dtype
eig
einsum
embedding
embedding_bag
embedding_renorm_
empty
empty_like
empty_meta
empty_quantized
empty_strided
enable_grad
eq
equal
erf
erf_
erfc
erfc_
erfinv
exp
exp2
exp2_
exp_
expm1
expm1_
eye
fake_quantize_per_channel_affine
fake_quantize_per_tensor_affine
fbgemm_linear_fp16_weight
fbgemm_linear_fp16_weight_fp32_activation
fbgemm_linear_int8_weight
fbgemm_linear_int8_weight_fp32_activation
fbgemm_linear_quantize_weight
fbgemm_pack_gemm_matrix_fp16
fbgemm_pack_quantized_matrix
feature_alpha_dropout
feature_alpha_dropout_
feature_dropout
feature_dropout_
fft
fill_
finfo
fix
fix_
flatten
flip
fliplr
flipud
float
float16
float32
float64
float_power
floor
floor_
floor_divide
fmax
fmin
fmod
fork
frac
frac_
frobenius_norm
from_file
from_numpy
full
full_like
functional
futures
gather
gcd
gcd_
ge
geqrf
ger
get_default_dtype
get_device
get_file_path
get_num_interop_threads
get_num_threads
get_rng_state
glob
greater
greater_equal
grid_sampler
grid_sampler_2d
grid_sampler_3d
group_norm
gru
gru_cell
gt
half
hamming_window
hann_window
hardshrink
has_cuda
has_cudnn
has_lapack
has_mkl
has_mkldnn
has_openmp
heaviside
hinge_embedding_loss
histc
hsmm
hspmm
hstack
hub
hypot
i0
i0_
igamma
igammac
iinfo
imag
import_ir_module
import_ir_module_from_buffer
index_add
index_copy
index_fill
index_put
index_put_
index_select
init_num_threads
initial_seed
inner
instance_norm
int
int16
int32
int64
int8
int_repr
inverse
is_anomaly_enabled
is_autocast_enabled
is_complex
is_deterministic
is_distributed
is_floating_point
is_grad_enabled
is_loaded
is_nonzero
is_same_size
is_signed
is_storage
is_tensor
is_vulkan_available
isclose
isfinite
isinf
isnan
isneginf
isposinf
isreal
istft
jit
kaiser_window
kernel32
kl_div
kron
kthvalue
last_error
layer_norm
layout
lcm
lcm_
ldexp
ldexp_
le
legacy_contiguous_format
lerp
less
less_equal
lgamma
linalg
linspace
load
lobpcg
log
log10
log10_
log1p
log1p_
log2
log2_
log_
log_softmax
logaddexp
logaddexp2
logcumsumexp
logdet
logical_and
logical_not
logical_or
logical_xor
logit
logit_
logspace
logsumexp
long
lstm
lstm_cell
lstsq
lt
lu
lu_solve
lu_unpack
manual_seed
margin_ranking_loss
masked_fill
masked_scatter
masked_select
matmul
matrix_exp
matrix_power
matrix_rank
max
max_pool1d
max_pool1d_with_indices
max_pool2d
max_pool3d
maximum
mean
median
memory_format
merge_type_from_type_comment
meshgrid
min
minimum
miopen_batch_norm
miopen_convolution
miopen_convolution_transpose
miopen_depthwise_convolution
miopen_rnn
mkldnn_adaptive_avg_pool2d
mkldnn_convolution
mkldnn_convolution_backward_weights
mkldnn_linear_backward_weights
mkldnn_max_pool2d
mkldnn_max_pool3d
mm
mode
moveaxis
movedim
msort
mul
multinomial
multiply
multiprocessing
mv
mvlgamma
name
nan_to_num
nan_to_num_
nanmedian
nanquantile
nansum
narrow
narrow_copy
native_batch_norm
native_group_norm
native_layer_norm
native_norm
ne
neg
neg_
negative
negative_
nextafter
nn
no_grad
nonzero
norm
norm_except_dim
normal
not_equal
nuclear_norm
numel
nvtoolsext_dll_path
ones
ones_like
onnx
ops
optim
orgqr
ormqr
os
outer
overrides
pairwise_distance
parse_ir
parse_schema
parse_type_comment
path_patched
pca_lowrank
pdist
per_channel_affine
per_channel_affine_float_qparams
per_channel_symmetric
per_tensor_affine
per_tensor_symmetric
pfiles_path
pinverse
pixel_shuffle
pixel_unshuffle
platform
poisson
poisson_nll_loss
polar
polygamma
pow
prelu
prepare_multiprocessing_environment
preserve_format
prev_error_mode
prod
profiler
promote_types
py_dll_path
q_per_channel_axis
q_per_channel_scales
q_per_channel_zero_points
q_scale
q_zero_point
qint32
qint8
qr
qscheme
quantile
quantization
quantize_per_channel
quantize_per_tensor
quantized_batch_norm
quantized_gru
quantized_gru_cell
quantized_lstm
quantized_lstm_cell
quantized_max_pool1d
quantized_max_pool2d
quantized_rnn_relu_cell
quantized_rnn_tanh_cell
quasirandom
quint4x2
quint8
rad2deg
rad2deg_
rand
rand_like
randint
randint_like
randn
randn_like
random
randperm
range
ravel
real
reciprocal
reciprocal_
relu
relu_
remainder
renorm
repeat_interleave
res
reshape
resize_as_
result_type
rnn_relu
rnn_relu_cell
rnn_tanh
rnn_tanh_cell
roll
rot90
round
round_
row_stack
rrelu
rrelu_
rsqrt
rsqrt_
rsub
saddmm
save
scalar_tensor
scatter
scatter_add
searchsorted
seed
select
selu
selu_
serialization
set_anomaly_enabled
set_autocast_enabled
set_default_dtype
set_default_tensor_type
set_deterministic
set_flush_denormal
set_grad_enabled
set_num_interop_threads
set_num_threads
set_printoptions
set_rng_state
sgn
short
sigmoid
sigmoid_
sign
signbit
sin
sin_
sinc
sinc_
sinh
sinh_
slogdet
smm
softmax
solve
sort
sparse
sparse_coo
sparse_coo_tensor
split
split_with_sizes
spmm
sqrt
sqrt_
square
square_
squeeze
sspaddmm
stack
std
std_mean
stft
storage
strided
sub
subtract
sum
svd
svd_lowrank
swapaxes
swapdims
symeig
sys
t
take
tan
tan_
tanh
tanh_
tensor
tensor_split
tensordot
testing
textwrap
th_dll_path
threshold
threshold_
tile
topk
torch
trace
transpose
trapz
triangular_solve
tril
tril_indices
triplet_margin_loss
triu
triu_indices
true_divide
trunc
trunc_
typename
types
uint8
unbind
unify_type_list
unique
unique_consecutive
unsafe_chunk
unsafe_split
unsafe_split_with_sizes
unsqueeze
use_deterministic_algorithms
utils
vander
var
var_mean
vdot
version
view_as_complex
view_as_real
vstack
wait
warnings
where
with_load_library_flags
xlogy
xlogy_
zero_
zeros
zeros_like

要查看 PyTorch 中特定函数的用法,可以使用 help() 函数,如下所示:


import torch
# 查看torch中add函数的用法
help(torch.add)

这将打印出 torch.add 函数的帮助文档,包括函数的参数、返回值、用法示例等。您也可以在 Jupyter Notebook 或 IPython 中使用 ? 符号来查看帮助文档,如下所示:

import torch
# 查看torch中add函数的用法
torch.add?

这将显示与上面 help(torch.add) 相同的帮助文档。


Output exceeds the size limit. Open the full output data in a text editor
Docstring:
add(input, other, *, out=None)
Adds the scalar :attr:`other` to each element of the input :attr:`input`
and returns a new resulting tensor.
.. math::
    \text{out} = \text{input} + \text{other}
If :attr:`input` is of type FloatTensor or DoubleTensor, :attr:`other` must be
a real number, otherwise it should be an integer.
Args:
    input (Tensor): the input tensor.
    value (Number): the number to be added to each element of :attr:`input`
Keyword arguments:
    out (Tensor, optional): the output tensor.
Example::
    >>> a = torch.randn(4)
    >>> a
    tensor([ 0.0202,  1.0985,  1.3506, -0.6056])
    >>> torch.add(a, 20)
...
            [-18.6971, -18.0736, -17.0994, -17.3216],
            [ -6.7845,  -6.1610,  -5.1868,  -5.4090],
            [ -8.9902,  -8.3667,  -7.3925,  -7.6147]])
Type:      builtin_function_or_method
相关文章
tesseract is not installed or it‘s not in your PATH解决办法!
简介:当我们想使用 pytesseract库的时候,我们开心的使用 pip install pytesseract安装完成后,却发现它并不能识别出图片内容,并且会抛出异常: pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it’s not in your PATH. See README file for more information.
tesseract is not installed or it‘s not in your PATH解决办法!
|
11月前
|
人工智能 监控 算法
AI(大模型)在公安案件侦办中的应用场景
本方案以AI赋能公安“案件侦办系统”,推出5款实战产品:AI笔录分析、证据链闭环验证、语义化知识库、多模态现场复现、全流程智能督办。聚焦提效、防错、赋能、合规,实现从“填表工具”到“实战中枢”的跃升。(239字)
2005 2
|
6月前
|
人工智能 IDE API
阿里云百炼 Coding Plan 深度解析:核心功能、接入配置与省钱订阅指南
阿里云百炼Coding Plan是专为AI编程场景打造的订阅制服务,以固定月费提供定额调用额度,聚合多模型能力并兼容主流开发工具,解决按量计费成本不可控、多模型切换繁琐等痛点。2026年该服务完成版本迭代,Lite基础版停售,仅保留Pro高级版,以下从核心功能、套餐配置、接入实操、省钱策略四大维度全面解析,帮助开发者高效选型与使用。
1373 2
|
9月前
|
人工智能 前端开发 Serverless
vLLM + SGLang + Ollama 自动适配!阿里云 Qwen3 部署智能选引擎
阿里云Qwen3正式开源8款混合推理模型(含2款MoE、6款Dense),支持119种语言,适配vLLM/SGLang/Ollama。依托函数计算FC与FunctionAI平台,提供模型服务与应用模板两种Serverless部署方式,最低GPU配置即可快速体验。
1529 20
|
11月前
|
机器学习/深度学习 人工智能 自然语言处理
代码检索新王登基!CodeFuse开源C2LLM,用“注意力池化”刷新MTEB-Code榜单
CodeFuse Embedding 家族最新成员 C2LLM 登顶 MTEB-Code 代码检索榜单,用注意力池化打破平均池化与 EOS 的僵局。
692 0
代码检索新王登基!CodeFuse开源C2LLM,用“注意力池化”刷新MTEB-Code榜单
|
监控 Java 应用服务中间件
微服务——SpringBoot使用归纳——为什么学习Spring Boot
本文主要探讨为什么学习Spring Boot。从Spring官方定位来看,Spring Boot旨在快速启动和运行项目,简化配置与编码。其优点包括:1) 良好的基因,继承了Spring框架的优点;2) 简化编码,通过starter依赖减少手动配置;3) 简化配置,采用Java Config方式替代繁琐的XML配置;4) 简化部署,内嵌Tomcat支持一键式启动;5) 简化监控,提供运行期性能参数获取功能。此外,从未来发展趋势看,微服务架构逐渐成为主流,而Spring Boot作为官方推荐技术,与Spring Cloud配合使用,将成为未来发展的重要方向。
691 0
微服务——SpringBoot使用归纳——为什么学习Spring Boot
|
12月前
|
缓存 监控 算法
API网关性能调优
本文系统讲解API网关性能调优全链路实战,涵盖选型(MSE vs 自建)、限流算法、缓存策略、超时配置、负载均衡、监控告警、熔断降级、安全防护、压测方法及百万QPS真实案例,助力构建高并发、高可用网关架构。
742 0
|
SQL 关系型数据库 MySQL
【MySQL数据库】SQL查询语句总结
【MySQL数据库】SQL查询语句总结
1130 0
|
存储 缓存 Java
理解Java引用数据类型:它们都是对象引用
本文深入探讨了Java中引用数据类型的本质及其相关特性。引用变量存储的是对象的内存地址而非对象本身,类似房子的地址而非房子本身。文章通过实例解析了引用赋值、比较(`==`与`equals()`的区别)以及包装类缓存机制等核心概念。此外,还介绍了Java引用类型的家族,包括类、接口、数组和枚举。理解这些内容有助于开发者避免常见错误,提升对Java内存模型的掌握,为高效编程奠定基础。
799 0
|
机器学习/深度学习 计算机视觉
YOLOv10实战:红外小目标实战 | 多头检测器提升小目标检测精度
本文改进: 在进行目标检测时,小目标会出现漏检或检测效果不佳等问题。YOLOv10有3个检测头,能够多尺度对目标进行检测,但对微小目标检测可能存在检测能力不佳的现象,因此添加一个微小物体的检测头,能够大量涨点,map提升明显; 多头检测器提升小目标检测精度,1)mAP50从0.666提升至0.677
2594 3