Gregor Koehler / Jul 21 2018

A Remix of: Keras/Tensorflow Template

Gregor Koehler

Checking Out the Environment

This is a remixed version of the official Keras/Tensorflow template. Just to see what the remix workflow is like, we'll use its environment to run a simple model on some random inputs.

Let's see which Python version we're using in this environment.

python --version

Ok, so it's Anaconda's Python 3.6. And it probably comes with Keras pre-installed (Tensorflow as backend) - hence the name.

pip freeze
import keras, tensorflow
print("Keras version: %s, Tensorflow version: %s." % 
      (keras.__version__, tensorflow.__version__))

Running a Simple Embedding Layer

from keras import Sequential
model = Sequential()
from keras.layers import Embedding
model.add(Embedding(1000, 64, input_length=10))
import numpy as np
input_array = np.random.randint(1000, size=(32, 10))
model.compile('rmsprop', 'mse')
output_array = model.predict(input_array)
print(output_array.shape)