This file contains hidden or 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
# tensorflow-slim very nicely includes some prebuilt models for us to make use of. | |
from tensorflow.contrib.slim.nets import resnet_v2 | |
class ModelCRNN_Resnet(ConvModel): | |
""" Recurrent Convolutional Neural Network based on resnet""" | |
MODEL_NAME = "model_resent" | |
MODEL_DESCRIPTION = "CNN + LSTM" | |
DEFAULT_PARAMS = { |
This file contains hidden or 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
import matplotlib.pyplot as plt | |
import numpy as np | |
gamma = 0.9 | |
def true_return(rewards, terminals): | |
returns = [] | |
acc = 0 | |
for r, term in zip(rewards[::-1], terminals[::-1]): | |
acc = acc * gamma * (1-term) + r |