Skip to content

Instantly share code, notes, and snippets.

View GuokaiLiu's full-sized avatar

Guokai Liu GuokaiLiu

View GitHub Profile
import torch
import torch.nn as nn
import torch.nn.functional as F
# * [1] Inputs and labels
inputs = torch.randn(4,3)
targets = torch.LongTensor([0,2,1,2])
print('[---Inputs and Targets:---]\n',inputs)
print(targets,'\n')
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : testhead.py
@Time : 2020/10/23 21:27:41
@Author : GuokLiu
@Contact : liuguokai@hust.edu.cn
@Institution : Huazhong Univ. of Sci. and Tech.
@Desc : None
'''
import torch
from torch import nn
import pytorch_lightning as pl
from torch.utils.data import DataLoader, random_split
from torch.nn import functional as F
from torchvision.datasets import MNIST
from torchvision import datasets, transforms
import os
@GuokaiLiu
GuokaiLiu / matrix_divide.md
Last active October 24, 2020 03:11
[矩阵除法] #math
  • 1 numpy.linalg.lstsq这个是什么意思啊?Link

  • 2 Is there a function for solving xA=b in opencv? Link

  • 3 MATLAB 之 \(左除) /(右除)Link

  • 4 Scipy教程 - 线性代数库scipy.linalg Link

  • 5 数值分析,四舍五入带来的误差错误 Link

@GuokaiLiu
GuokaiLiu / test3
Created October 21, 2020 15:51
This is a welcome test.
import numpy as np
print(np.zeros)
@GuokaiLiu
GuokaiLiu / snippetslab
Last active November 24, 2020 21:07
This is a welcome test.|-|{"files":{"snippetslab":{"env":"python"}},"tag":"Uncategorized"}
file_name = 'N09_M07_F10_K001_1.mat'
kat = sio.loadmat(file_name)[[i for i in kat.keys() if 'N' in i][0]]
sensor = 6 # force:0, current1:1, current2:2, speed:3, torque:4, temperature:5, vibration:6
a = kat['Y'][0, 0][0,sensor][2]
@GuokaiLiu
GuokaiLiu / test.py
Created October 21, 2020 15:12
test|-|{"files":{"test.py":{"env":"python"}},"tag":"GROUP"}
import numpy as np
a = np.ones(1)
print(a)
@GuokaiLiu
GuokaiLiu / matrix_divide.md
Last active October 21, 2020 02:56
[矩阵除法] #math
  • 1 numpy.linalg.lstsq这个是什么意思啊?Link

  • 2 Is there a function for solving xA=b in opencv? Link

  • 3 MATLAB 之 \(左除) /(右除)Link

  • 4 Scipy教程 - 线性代数库scipy.linalg Link

  • 5 数值分析,四舍五入带来的误差错误 Link