【Torch API】pytorch中的torch.sort()函数解析

PyTorch张量排序实战:torch.sort()参数详解与多维场景应用 本文深入解析PyTorch中torch.sort()函数的核心参数与应用技巧。通过对比dim、descending、stable等关键参数,并结合二维矩阵与三维及以上张量的实战示例,详细阐述了在CV、NLP等多维数据处理场景下的排序逻辑与高效实现方法,帮助开发者掌握这一数据整理利器。 阅读详情

1.用法介绍

 pytorch中的torch.sort()是按照指定的维度对tensor张量的元素进行排序。

torch.sort(input, dim=-1, descending=False, stable=False, * ,out =None)
输入:

input(tensor): 表示输入的张量
dim(int, optional):表示张量元素排序的维度
descending(bool, optional):0表示升序,1表示降序
stable(bool, optional):保持张量中相等元素的顺序
输出:

第一个tensor表示对应维度张量值排序;第二个tensor表示对应维度张量值得索引序列
 

2. 代码实例

 torch.sort()的代码实例如下所示:

import torch

torch.manual_seed(2)
Tensor = torch.rand((3,3))
print(Tensor)

print(torch.sort(Tensor,0)) # print(Tensor.sort(0))
print(torch.sort(Tensor,1)) # print(Tensor.sort(1))

运行的实验结果如下所示:

tensor([[0.6147, 0.3810, 0.6371],
        [0.4745, 0.7136, 0.6190],
        [0.4425, 0.0958, 0.6142]])
torch.return_types.sort(
values=tensor([[0.4425, 0.0958, 0.6142],
        [0.4745, 0.3810, 0.6190],
        [0.6147, 0.7136, 0.6371]]),
indices=tensor([[2, 2, 2],
        [1, 0, 1],
        [0, 1, 0]]))
torch.return_types.sort(
values=tensor([[0.3810, 0.6147, 0.6371],
        [0.4745, 0.6190, 0.7136],
        [0.0958, 0.4425, 0.6142]]),
indices=tensor([[1, 0, 2],
        [0, 2, 1],
        [1, 0, 2]]))

torch.sort() vs torch.argsort():PyTorch排序函数深度对比及性能优化技巧 本文深入对比了PyTorch中的torch.sort()和torch.argsort()函数,解析其核心功能、底层实现及性能差异。通过CUDA并行计算原理和实际性能测试数据,为开发者提供专业级的优化技巧,包括内存布局优化、硬件感知策略等,帮助提升深度学习模型中的排序操作效率。 阅读详情

相关推荐

PyTorch性能优化7大实战技巧:从内存管理到调试提速

PyTorch作为主流深度学习框架,其动态图特性在带来灵活性的同时,也隐含大量运行时不确定性——显存溢出、训练不可复现、数据加载瓶颈、梯度异常、部署失败等问题频发。这些现象本质源于对底层执行机制(如CUDA内存分配、随机种子传播、计算图构建、CPU-GPU协同)的理解偏差。掌握PyTorch性能优化与开发效率提升的关键,在于聚焦可量化、可隔离、可回滚的最小必要动作:固定全栈随机种子保障可复现性,合理配置DataLoader实现CPU-GPU负载均衡,启用pin_memory+non_blocking加速数据

weixin_34082789的博客 879

PyTorch torch.max底层原理与工程避坑指南

torch.max是PyTorch中关键的张量维度聚合算子,其本质并非简单取最大值,而是遵循‘维度压缩+计算图保全’的设计原则,通过返回(values, indices)二元组支持可导、可广播、可复现的极值提取。它在分类预测、通道注意力、序列掩码和硬样本挖掘等场景中承担核心角色,但极易因dim理解偏差、keepdim误设、dtype不匹配或设备混用引发shape错乱、梯度截断、显存溢出等生产级故障。掌握其与torch.topk的分工边界、对nan_policy的支持差异及多维压缩坐标系建模方法,是构建稳定深

weixin_30421809的博客 478

无人机飞控传感器全解析:从IMU到光流传感器的实战应用

本文深入解析了无人机飞控系统的核心传感器,从IMU、气压计、磁力计到光流传感器,详细阐述了其工作原理、数据融合策略及常见挑战。结合ICF5、Pixhawk 6C等主流飞控硬件,提供了从传感器校准、滤波器调优到应对室内光流定位、强磁干扰等实战场景的系统性优化指南,帮助开发者突破飞控“黑箱”,实现更稳定、可靠的飞行控制。

weixin_28396629的博客 167

torch.sort

torch.sort() 方法原型: torch.sort(input, dim=None, descending=False, out=None) -> (Tensor, LongTensor) 返回值: A tuple of (sorted_tensor, sorted_indices) is returned, where the sorted_indices are the indices of the elements in the original input tensor. 参数 .

你的博客 2万+

从PHY芯片看工业网络精准时钟:IEEE 1588v2(PTP)协议实现与选型指南

本文深入解析了工业网络中IEEE 1588v2(PTP)协议的实现与PHY芯片选型要点。通过对比KG7101、RTL8211F等芯片的关键参数,揭示硬件时间戳对纳秒级时钟同步的决定性作用,并提供PTP网络设计中的拓扑布局与配置优化技巧,助力工业自动化场景实现精准时间同步。

weixin_42628688的博客 500

MATLAB AppDesigner 中TextArea保留原有信息并换行显示提示信息

App Designer 中的文本区域TextArea组件,一般可以用来作为matlab app设计中的信息显示。 app.TextArea.Value = 'Hello Matlab'; Value可以是字符向量、字符向量元胞数组、字符串数组或一维分类数组。这样直接给TextArea赋值,每次赋值都会消除先前的信息,然后显示新的信息。如果想要在app实现保留原有信息、多行信息的输出,在MathWorks官方帮助中心给出了一种方法: cellArrayText{1} = sprintf('%s\n

我是麻瓜喔的博客 1万+

pytorch torch.sort()的用法以及例子

1.作用 对tensor中元素排序 2.用法 dim = -1,按照行排序,dim= 1按照列排序,descending=True,则递减排序,否则递增 3.例子 按照行排序 logits = torch.tensor([[[-0.5816, -0.3873, -1.0215, -1.0145, 0.4053], [ 0.7265, 1.4164, 1.3443, 1.2035, 1.8823], [-0.4451, 0.1673, 1.2590,

凝眸伏笔的博客 7702

uniapp 如何封装实现任意页面都能使用的全局弹窗

项目内容场景全局监听消息提示难点uniapp 无法全局挂载组件解决方案动态创建 DOM + 动态 Vue 实例优势跨页面 / 不依赖页面组件树 / 灵活调用如果你使用的是小程序平台,DOM 操作可能受限,需要用或方式兼容处理。想支持多个弹窗堆叠?你可以扩展,加个弹窗队列管理器。

代码简单说 Vue、JAVA、PHP、Node.js 熟练运用,接口、架构、性能全搞定。 944

torch中的sort用法|torch.sort

掌握torch中的sort函数

qq_37977007的博客 1694

开关电源-LLC基本原理

本文详细介绍了LLC谐振变换器的兴起原因、基本工作原理、变换器特点及拓扑结构。重点讨论了半桥、全桥LLC及其软开关技术,包括零电压开关(ZVS)和零电流开关(ZCS)。通过理解简单的谐振电路(RL、RC、LC)来阐述LLC如何改变电压增益,以及如何通过调节频率实现输出电压的稳定性。

让你爱上电路设计 2万+

对CryptoDriver里密钥格式定义的探索(1)

一入网络安全才发现深似海,传统汽车MCU码农转型之路异常艰难。在CP AUTOSAR中的CryptoDriver SWS对密钥格式的需求来源于RFC,其中要求了RSA、ECC、SHE等key material的格式。再往下看,我就有些迷糊了,例如关于RSA Private Key的OCTEE STRING格式根据IETF RFC8017,Public Key又得根据RFC5280,完全不得其解。所以今天先从生成密钥对,并对其进行解析开始,一步一步拆解。

认真搞搞汽车MCU 527

【Torch API】pytorch中的torch.argsort() 函数详解

torch.argsort() 函数详解

devil_son1234的博客 1168

088、多摄像头跨镜目标追踪 ID 频繁切换?ReID 特征 + 轨迹关联 + 时间约束方案

文章摘要:本文针对多摄像头跨镜目标追踪中ID频繁切换的问题,提出了一种结合ReID特征、轨迹关联和时间约束的综合解决方案。作者分析了ID切换的三个主要原因:ReID特征不稳定、轨迹关联依赖最近邻匹配以及忽略时间约束。通过改进ReID特征提取(多层特征融合)、引入轨迹预测(卡尔曼滤波)和添加时间窗口约束,成功将ID切换率从35%降至3%以下。文章详细分享了实现细节和踩坑经验,为跨摄像头目标追踪提供了实用优化思路。

ai技术增长的博客 169

PyTorch torch.Tensor 权威指南:张量创建、索引、自动求导与核心 API 全解析

`torch.Tensor` 是 PyTorch 深度学习框架中最核心的数据结构,是一个保存单一数据类型元素的多维矩阵。本指南以仓库文档 [docs/source/tensors.md](https://link.gitcode.com/i/86d5bae4c8e55f1b2cae9e930e35fc2f) 为主体,结合仓库源码(`torch/_tensor.py`、`torch/_refs/__

gitblog_00928的博客 482

南 京 农 业 大 学 试 题 纸 附表(rape.csv)是25个油菜材料,测得每个材料的千粒重、亚油酸等的含量. (1) 对物质含量的八个指标作主成分分析,画出碎石图和主成分得分图; (2) 选

(1)请用n1

Mrrunsen的博客 497

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

PyTorch torch 命名空间完全指南:张量运算、加速器、随机采样与序列化全景解析

本文以 PyTorch 官方 API 参考文档 [docs/source/torch.md](https://link.gitcode.com/i/5aff889c4a5aeabb4569fc91376775fe) 为骨架,系统梳理顶层 `torch` 命名空间的核心能力,涵盖张量创建与索引、加速器(CUDA/XPU/MPS 等)体系、随机采样、序列化、并行控制、梯度禁用、各类数学运算、符号数字与

gitblog_00058的博客 685

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

小白学Pytorch系列--Torch API (7)

小白学Pytorch系列--Torch API (7)

发呆的比目鱼的博客 2019

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

PyTorch运行时本质:从torch.compile到FSDP的底层原理与工程实践

PyTorch不是静态图框架,其动态性源于运行时实时构建计算图、即时生成梯度函数与动态内存调度。理解这一本质,是突破性能瓶颈的关键——80%的慢速问题源于环境层与运行时层交界处,而非模型结构本身。torch.compile实为符号执行驱动的图重写系统,依赖FakeTensor追踪与ATen算子融合;FSDP则重构了分布式训练的内存契约,通过参数/梯度/优化器状态分片实现显存线性下降。这些高级能力只有在掌握CUDA兼容性、profiler多维时间对齐、DDP通信原语等底层机制后,才能稳定落地于A100、Jet

weixin_33937913的博客 479

PyTorch 性能调优全景笔记:从 Profiling 到 torch.compile 再到分布式扩展

在深度学习工程实践中,模型训练效率往往受制于底层框架的执行细节,而并非单纯依赖算法结构。PyTorch 作为主流深度学习框架,其动态图机制在灵活性与性能之间天然存在权衡,训练过程中的数据加载、算子执行、显存分配乃至 GPU 同步都可能成为性能瓶颈。性能优化需要遵循“先剖析、再优化”的工程原则,借助 torch.profiler 等工具定位真实耗时热点,理解 kernel 启动开销与数据流水线对 GPU 利用率的影响。在此基础上,利用 torch.compile 的算子融合与 CUDA Graph 机制能够显

weixin_34099526的博客 361

Faiss contrib 模块深度解析:从分布式索引、磁盘合并到 PyTorch 互操作的 Python 辅助库

faiss 的 `contrib/` 目录是一组随 Python 包一起编译为 `faiss.contrib` 模块的辅助工具库,覆盖分布式检索、磁盘索引合并、超大规模暴力搜索、PyTorch 张量互操作、IVF 索引高级操控等场景。本文基于仓库内的 [contrib/README.md](https://link.gitcode.com/i/8d002de7c6189a59c0310257a9a

gitblog_00875的博客 745

torchprof 已被废弃?如何平滑迁移到 PyTorch 1.9+ 官方 Profiler

如果你在用 **torchprof** 做 PyTorch 模型逐层性能分析(layer-by-layer profiling),你可能已经注意到:它已被官方标记为废弃。从 PyTorch 1.9 开始,官方内置了全新的 Profiler(`torch.profiler`),能力完全覆盖并超越了 torchprof。本文带你搞清楚三件事:为什么废弃、如何平滑迁移到 PyTorch 1.9+ 官方

gitblog_01131的博客 270

PyTorch Deep Dive 指南:剖析、剪枝、蒸馏与模型性能优化教程全景

> Deep Dive 是 PyTorch Tutorials 仓库中的"深度技术"分区,聚焦如何通过剖析(Profiling)、超参调优、量化、剪枝、参量化约束等手法提升 PyTorch 模型的效率与速度。阅读本篇,你将系统了解该板块 15 个教程各自的适用场景、核心技术要点与源码入口,并能直接跳转到对应教程展开实战。 ## 板块定位:围绕模型性能的深潜路线图 在 [deep-dive.rs

gitblog_00711的博客 536

PyTorch Frame API完全参考:从数据加载到模型评估的全方位手册

PyTorch Frame是一个专为异构表格数据设计的深度学习框架,它提供了一套完整的API用于构建、训练和评估表格深度学习模型。无论你是数据科学家、机器学习工程师还是研究人员,这份全方位手册将帮助你快速掌握PyTorch Frame的核心API功能,从数据加载到模型评估的每一个环节。🚀 ## 📊 核心架构与设计理念 PyTorch Frame采用模块化设计,将表格数据处理流程分解为三个核

gitblog_00552的博客 435

PyTorch C++ 前端 nn Utilities 全解析:参数初始化、模块克隆与 Pad/Upsample 工具集

PyTorch 除了广为人知的 Python API,还提供一套完整的 C++ 前端(libtorch)。在 `torch::nn` 命名空间下,除了线性层、卷积、RNN 等具体模块,还有一批贯穿各模块使用的"支撑工具":参数初始化、模块深拷贝(Cloneable)、类型擦除容器(AnyModule)、Padding 填充层与视觉相关层(PixelShuffle/Upsample/Fold)等。本

gitblog_00057的博客 234

《Pytorch学习指南》- 基础API(2)

1. inplace和广播机制 in-place 操作 就地操作, 不适用临时变量, 比如 a.add_(b) = a + b => 计算结果直接赋值给 a 等价于 a += b 广播机制 张量参数可以自动的扩展为相同的大小 广播机制满足的条件 每个张量至少有一个维度 满足右对齐 : 例如 torch.rand(2,1,1) 和 torch.rand(3) , 如果维度的最后一个维度, 比如 torch.rand(2,1,1) 最后一个是1, torch.rand(3)最后一个维度是3 满

兀坐晴窗独饮茶 248

Ludwig 中的 entmax:从 sparsemax 到可学习稀疏性的 α-entmax 概率映射与损失函数实战指南

本文围绕 Ludwig 仓库内置的 [entmax 实现](https://link.gitcode.com/i/d6385a854398143469a0cc2fe06e4f74) 展开,系统讲解一类稀疏概率映射及其配套损失函数:entmax 家族以 Tsallis α-熵推广 softmax,在保留可微性的同时让输出概率产生精确的零值,从而在注意力、多标签分类、TabNet 特征选择等场景中天然

gitblog_00521的博客 647
上一篇: 【Torch API】torch.chunk()用法详解
下一篇: 【Torch API】pytorch中的torch.topk() 函数详解
devil_son1234
博客等级 码龄9年 64粉丝 10原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值