Skip to content

Instantly share code, notes, and snippets.

View mttk's full-sized avatar

Martin Tutek mttk

View GitHub Profile
@mttk
mttk / repro_undefined_tensor.py
Last active September 18, 2018 15:02
Undefined tensor error in pytorch
import torch
import torch.nn as nn
import torch.nn.functional as F
# Just some regular data definition
device = 'cuda:0'
embed_dim = 2
hidden_dim = 2
B = 4
import torch
import torch.nn as nn
import torch.nn.functional as F
embed_dim = 2
hidden_dim = 2
B = 4
T = 2
y = torch.tensor([0, 1, 0, 1])
@mttk
mttk / lstm_backward.py
Created September 11, 2018 13:37
LSTM stepwise backward
lstm = torch.lstm_cell
grad_history = []
def store_grads(name, timestep):
def hook(grad):
print(name, grad, timestep)
grad_history[timestep][name] = grad
return hook
def lstm_stepwise(input, h0, w_ih, w_hh, b_ih, b_hh):
@mttk
mttk / ssds-instructions.md
Created September 22, 2017 12:52
Installation Instructions - Summer School of Data Science, September 2017, Split

SSDS 2017 - 2nd Int'l Summer School on Data Science

Center of Research Excellence for Data Science and Advanced Cooperative Systems, Research Unit for Data Science

Hands-on sessions for 2nd International Summer School on Data Science organized by the Center of Research Excellence for Data Science and Advanced Cooperative Systems, Research Unit for Data Science, from September 25-29, 2017 in Split, Croatia.

Table Of Contents

  • Day 1 - Introduction to Tensorflow
  • Day 2 - Convolutional Neural Networks for Image Classification
@mttk
mttk / upscaling_gym_render.py
Created June 29, 2016 11:46
Scaling up the displays from the OpenAI gym to allow a visible simulation of smaller renders (ex. atari games) for presentative purposes
import logging
import os, sys
import numpy as np
import matplotlib.pyplot as plt
import gym
import Image
# Import the renderer as it's what we'll be using to plot
from gym.envs.classic_control import rendering