zoukankan      html  css  js  c++  java
  • torch:torch.sort

    import torch
    import torchvision
    import torch.nn as nn
    import torch.nn.functional as F
    
    x = torch.randn(3, 4)
    print(x)
    print()
    sorted, indices = torch.sort(x)
    print(sorted)
    print(indices)
    
    sorted, indices = torch.sort(x, 0)
    print(sorted)
    print(indices)
    D:ProgramDataMiniconda3python.exe E:/新脚本主文件夹/训练测试项目/test_torch/sort.py
    tensor([[ 1.0198,  0.6535, -0.5993, -1.2033],
            [-1.2741, -0.1615, -1.4329, -2.1151],
            [-1.8084, -0.3558,  0.6515, -0.2942]])
    
    tensor([[-1.2033, -0.5993,  0.6535,  1.0198],
            [-2.1151, -1.4329, -1.2741, -0.1615],
            [-1.8084, -0.3558, -0.2942,  0.6515]])
    tensor([[3, 2, 1, 0],
            [3, 2, 0, 1],
            [0, 1, 3, 2]])
    tensor([[-1.8084, -0.3558, -1.4329, -2.1151],
            [-1.2741, -0.1615, -0.5993, -1.2033],
            [ 1.0198,  0.6535,  0.6515, -0.2942]])
    tensor([[2, 2, 1, 1],
            [1, 1, 0, 0],
            [0, 0, 2, 2]])
    
    Process finished with exit code 0
  • 相关阅读:
    python 项目实例
    flash教程
    flask request
    systemd-unit
    kubernets HA集群手动部署
    zookeeper(1)-简单介绍
    apache与nginx原理
    技术文章整理
    CMS垃圾回收器
    Zookeeper
  • 原文地址:https://www.cnblogs.com/DDBD/p/14096802.html
Copyright © 2011-2022 走看看