Skip to content

Instantly share code, notes, and snippets.

@HaiyongJiang
HaiyongJiang / foo.py
Created August 15, 2018 12:16 — forked from anonymous/foo.py
import torch
from torch.autograd import Variable, Function
class Linear(Function):
# Note that both forward and backward are @staticmethods
@staticmethod
# bias is an optional argument
def forward(ctx, input, weight, bias=None):
ctx.save_for_backward(input, weight, bias)
@HaiyongJiang
HaiyongJiang / memo.md
Created August 13, 2018 09:25 — forked from cia-rana/memo.md
CVPR2017 - 3D Reconstruction関連

CVPR2017 - 3D Reconstruction関連

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

# [filter size, stride, padding]
#Assume the two dimensions are the same
#Each kernel requires the following parameters:
# - k_i: kernel size
# - s_i: stride
# - p_i: padding (if padding is uneven, right padding will higher than left padding; "SAME" option in tensorflow)
#
#Each layer i requires the following parameters to be fully represented:
# - n_i: number of feature (data layer has n_1 = imagesize )
# - j_i: distance (projected to image pixel distance) between center of two adjacent features
import numpy as np
import re
import sys
'''
Load a PFM file into a Numpy array. Note that it will have
a shape of H x W, not W x H. Returns a tuple containing the
loaded image and the scale factor from the file.
'''
def load_pfm(file):
@HaiyongJiang
HaiyongJiang / tmux.md
Created September 16, 2017 02:15 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@HaiyongJiang
HaiyongJiang / vim_configuration_with_full_support
Last active August 11, 2017 13:53
Installing vim with lua, python on Ubuntu/LinuxMint
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-gui-common
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev libncurses5-dev libatk1.0-dev libx11-dev libxpm-dev libxt-dev
sudo rm -rf /usr/local/share/vim
sudo rm /usr/bin/vim
sudo mkdir /usr/include/lua5.1/include
sudo cp /usr/include/lua5.1/*.h /usr/include/lua5.1/include/
# suppose you have created a ui file called configwin.ui
cmake_minimum_required (VERSION 2.6)
project(tst)
find_package(Qt5Widgets)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@HaiyongJiang
HaiyongJiang / gist:6d03f33854118853c4f9
Created May 8, 2015 09:13
load dependency dll ,add env path.
bool LoadDependencyDLL(const std::string path)
{
std::vector<std::string> filters;
filters.push_back("*.dll");
filters.push_back("*.DLL");
std::vector<std::string> fileList = getFileNameLists(path, filters, false, true);
for(int i=0; i<fileList.size(); i++)
{
if(fileList[i].find(".dll") != -1)
{
#include <iostream>
#include <lemon/smart_graph.h>
#include <lemon/lgf_reader.h>
#include <lemon/lgf_writer.h>
#include <lemon/capacity_scaling.h>
using namespace lemon;
int main() {
SmartDigraph g;