Skip to content

Instantly share code, notes, and snippets.

View XinDongol's full-sized avatar
🏁
Loading...

Xin (Simon) Dong XinDongol

🏁
Loading...
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from graphviz import Digraph
from torch.autograd import Variable
import torch
def make_dot(var, params=None):
if params is not None:
assert isinstance(params.values()[0], Variable)
param_map = {id(v): k for k, v in params.items()}
import torch.nn as nn
import torch.nn.functional as F
import torch
class DeepInversionFeatureHook():
'''
Implementation of the forward hook to track feature statistics and compute a loss on them.
Will compute mean and variance, and will use l2 as a loss
'''
def __init__(self, module):
self.hook = module.register_forward_hook(self.hook_fn)
https://repl.it/
# coding:utf-8
from turtle import *
def nose(x,y):#鼻子
pu()
goto(x,y)
pd()
seth(-30)
\usepackage{soul}
\newcommand{\xinc}[1]{\textcolor{blue}{[Xin:$\rightarrow$#1]}}
\newcommand{\xina}[1]{\textcolor{blue}{[Xin:$+$#1]}}
\newcommand{\xin}[1]{\textcolor{blue}{[Xin:#1]}}
\newcommand{\xind}[1]{\textcolor{blue}{[Xin:\st{#1}]}}
%% parameters
delta = 0.5;
a2 = 0.1;
a1 = 100;
number_of_pieces = 100; % number of pieces we want to divide
%%
b2 = delta/tanh(a2*delta);
b1 = delta/tanh(a1*delta);
thres_min = zeros(1,number_of_pieces)+1000;
amin = zeros(1,number_of_pieces);

GPU

GeForce GTX 1080 Ti Mem: 12GB

CPU

processor : 15 vendor_id : GenuineIntel cpu family : 6 model : 63 model name : Intel(R) Core(TM) i7-5960X CPU @ 3.00GHz stepping : 2 microcode : 0x3d

from torch.autograd import Variable
import torch
from torch import nn
from collections import OrderedDict
from IPython import embed
from torch.autograd.function import InplaceFunction, Function
import torch.nn.functional as F
import math