Skip to content

Instantly share code, notes, and snippets.

import tensorflow as tf
from memory_profiler import profile
import argparse
@profile
def test(device, case, soft_placement):
print(device, case, soft_placement)
config = tf.ConfigProto()
import numpy as np
import theano
import theano.tensor as T
import lasagne
from collections import OrderedDict
def get_adam_steps_and_updates(all_grads, params, learning_rate=0.001,
beta1=0.9, beta2=0.999, epsilon=1e-8):
t_prev = theano.shared(lasagne.utils.floatX(0.))
import numpy as np
from keras.models import Sequential
from keras.layers import GRU, Activation
INP_DIM = 10
OUT_DIM = 3
BATCH_SIZE = 1
SEQ_LEN = 5
model1 = Sequential()
from keras.layers import Merge, InputLayer, Dense, Input, merge, Permute, Layer, Lambda
from keras.models import Sequential, Model
from keras import backend as K
import numpy as np
FEATURE_SIZE = 10
FEATURE_BATCH = 10
INDICES_SIZE = FEATURE_BATCH
INDICES_BATCH = 5
HIDDEN_SIZE = 20
@fgvbrt
fgvbrt / sum_x_rows.py
Created February 23, 2017 11:21
performing operation like X[I].sum(axis=1) on keras
from keras.layers import Merge, InputLayer, Dense, Input, merge
from keras.models import Sequential, Model
from keras import backend as K
import numpy as np
FEATURE_SIZE = 10
FEATURE_BATCH = 10
INDICES_SIZE = FEATURE_BATCH
INDICES_BATCH = 5