This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
import math | |
import time | |
import tensorflow.python.platform | |
import tensorflow as tf | |
FLAGS = tf.app.flags.FLAGS | |
# TODO: why is batch size 64 going OOM? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import absolute_import | |
from __future__ import print_function | |
import numpy as np | |
np.random.seed(1337) # for reproducibility | |
import random | |
from keras.datasets import mnist | |
from keras.models import Sequential, Graph | |
from keras.layers.core import * | |
from keras.optimizers import SGD, RMSprop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import absolute_import | |
from __future__ import print_function | |
import numpy as np | |
np.random.seed(1337) # for reproducibility | |
import random | |
from keras.datasets import mnist | |
from keras.models import Sequential | |
from keras.layers.core import * | |
from keras.optimizers import SGD, RMSprop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import absolute_import | |
from __future__ import print_function | |
import numpy as np | |
np.random.seed(1337) # for reproducibility | |
import theano.tensor as T | |
from keras.datasets import mnist | |
from keras.models import Sequential | |
from keras.layers.core import Dense, Dropout, Activation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.models import Sequential | |
from keras.layers.core import Permute, Flatten, Layer | |
from keras.layers.convolutional import Convolution2D | |
from keras.layers.core import Activation | |
import theano | |
import theano.tensor as T | |
import datetime | |
import numpy as np | |
assert theano.config.optimizer_excluding == 'cudnn', \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function profiling | |
================== | |
Message: build/bdist.linux-x86_64/egg/keras/models.py:399 | |
Time in 1 calls to Function.__call__: 1.027354e+01s | |
Time in Function.fn.__call__: 1.026697e+01s (99.936%) | |
Time in thunks: 1.017123e+01s (99.004%) | |
Total compile time: 1.421726e+00s | |
Number of Apply nodes: 140 | |
Theano Optimizer time: 1.223497e+00s | |
Theano validate time: 6.331444e-02s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.models import Sequential | |
from keras.layers.core import Permute | |
from keras.layers.convolutional import Convolution2D | |
from keras.layers.core import Activation | |
import theano | |
import theano.tensor as T | |
import datetime | |
import numpy as np | |
now = datetime.datetime.now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import absolute_import | |
from __future__ import print_function | |
from keras.datasets import mnist | |
from keras.models import Sequential | |
from keras.layers.core import Dense, Dropout, Activation, Flatten | |
from keras.layers.convolutional import Convolution2D, MaxPooling2D | |
from keras.utils import np_utils | |
from scipy.special import expit | |
import numpy as np | |
np.set_printoptions(suppress=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'cudnn' | |
require 'fbcunn' | |
local timer = torch.Timer() | |
local tensorsAreProbablySimilar = function(l, r, epsilon) | |
epsilon = epsilon or 0.00001 | |
return math.abs((l:norm() - r:norm()) / (l:norm() + r:norm())) < epsilon | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function rgbToYuv(rgbTensor) | |
local r,g,b = rgbTensor[1],rgbTensor[2],rgbTensor[3] | |
local yuvTensor = rgbTensor:clone() | |
yuvTensor[1] = torch.mul(r, 0.299) + torch.mul(g, 0.587) + torch.mul(b, 0.114) | |
yuvTensor[2] = torch.mul(b - yuvTensor[1], 0.492) | |
yuvTensor[3] = torch.mul(r - yuvTensor[1], 0.877) | |
return yuvTensor | |
end | |
local function yuvToRgb(yuvTensor) |
NewerOlder