原创 pytorch-custom dataset

import torch import torch.utils.data as data 1.  class CustomDataset(data.Dataset): __init__(self, transform) __len__(

原创 pytorch-multi-gpu

1. nn.DataParallelmodel = nn.DataParallel(model.cuda(1), device_ids=[1,2,3,4,5])criteria = nn.Loss() # i. .cuda(1)  20G

原创 pytorch-containers

Module Seqential ModuleList In [90]: class MM(nn.Module): ...: def __init__(self): ...: super(MM

原创 python-skimage

1. skimage.util crop pad random_noise regular_grid view_as_windows view_as_blcks 2. skimage.transform img = np.array(

原创 pytorch-design NEW Function and Module

Design NEW Function and Module class LinearFunc(torch.autograd.Function): @staticmethod def forward(ctx, inp

原创 pytorch-errors

0.RuntimeError: save_for_backward can only save input or output tensors, but argument 0 doesn't satisfy this conditionW

原创 pytorch-loss function

nn.LogSoftmax() F.log_softmax() nn.NLLLoss() nn.NLLLoss2d() -----------------reference--------------- 1.htt

原创 pytorch-hook

1. register_forward_hook(hook) 2.  register_backward_hook(hook) /home/lyu/anaconda2/lib/python2.7/site-packages/tor

原创 python-bisect/np-searchsorted

bisect() np.searchsorted()

原创 visual studio-third part lib

Configuration Properties -> VC++Directories -> Include Directories(.h)   Library Directories(.lib)  Linker/Input add .

原创 83. Remove Duplicates from Sorted List

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode

原创 N/D to float number

#include "stdafx.h" #include<stdio.h> #include<iostream> #include<vector> #include<string> #include<sstream> using na

原创 linux-screen

screen  screen -S xx screen -ls screen -r xx ctrl + a+ d

原创 python-pypdf2

from PyPDF2 import PdfFileWriter, PdfFileReader pdf_input = PdfFileReader(open('xx.pdf', 'rb')) pdf_output = PdfFile

原创 pytorch-tensor data type

1.   torch.FloatTensor(2,3).normal_(0,1) torch.LongTensor(2,3).random(0,4) torch.FloatTensor/Tensor(arr)  it don't s