# Path: ops/ops.py
# DATA_FORMAT_NCHW = 'NCHW'
# DATA_FORMAT_NHWC = 'NHWC'
# def signed_sqrt(inputs, scope):
# def l2_norm(inputs, scope):
#     def __init__(self, num_units, input_size=None, activation=tanh):
#     def state_size(self):
#     def output_size(self):
#     def __call__(self, inputs, state, scope=None):
# def _linear(args, output_size, bias, bias_start=0.0, scope=None):
# def adjust_max(start, stop, start_value, stop_value, name=None):
# def fused_batch_norm(
#         inputs,
#         renorm=False,
#         RMAX=None,
#         DMAX=None,
#         decay=0.999,
#         center=True,
#         scale=False,
#         epsilon=0.001,
#         activation_fn=None,
#         param_initializers=None,
#         is_training=True,
#         reuse=None,
#         variables_collections=None,
#         outputs_collections=None,
#         trainable=True,
#         data_format=DATA_FORMAT_NHWC,
#         zero_debias_moving_mean=False,
#         scope=None):
#         def _fused_batch_norm_training():
#         def _fused_batch_norm_inference():
#             def _delay_updates():
# class GRUCell(RNNCell):


import tensorflow as tf
import numpy as np
from tensorflow.python.ops.math_ops import sigmoid
from tensorflow.python.ops.math_ops import tanh
from tensorflow.contrib.rnn.python.ops import core_rnn_cell_impl
from ops import ops
try:
    xrange
except NameError:
    xrange = range
_linear = ops._linear
RNNCell = tf.contrib.rnn.RNNCell
LSTMStateTuple = tf.contrib.rnn.LSTMStateTuple


def shuttleNet(inputs, n_steps, num_mem, mem_dim,
            num_round,
            echocell,
            lstm_type="encell",
            activation=tf.tanh,
            num_frames=None,
            scope=None,
            reuse=None):
    with tf.variable_scope(scope, 'LSTM', [inputs], reuse=reuse):
        if lstm_type == "encell":
            input_shape = inputs.get_shape()
            inputs = tf.reshape(inputs, [input_shape[0].value, -1])
            batch_size = int(input_shape[0].value / n_steps)
            if echocell == "BASIC":
                cell = tf.contrib.rnn.BasicLSTMCell(mem_dim, forget_bias=1.0,
                                                    state_is_tuple=False,
                                                    activation=activation)
            elif echocell == "LSTM":
                cell = tf.contrib.rnn.LSTMCell(mem_dim, state_is_tuple=False,
                                               activation=activation)
            elif echocell == "GRU":

# Path: ops/ops.py
# DATA_FORMAT_NCHW = 'NCHW'
# DATA_FORMAT_NHWC = 'NHWC'
# def signed_sqrt(inputs, scope):
# def l2_norm(inputs, scope):
#     def __init__(self, num_units, input_size=None, activation=tanh):
#     def state_size(self):
#     def output_size(self):
#     def __call__(self, inputs, state, scope=None):
# def _linear(args, output_size, bias, bias_start=0.0, scope=None):
# def adjust_max(start, stop, start_value, stop_value, name=None):
# def fused_batch_norm(
#         inputs,
#         renorm=False,
#         RMAX=None,
#         DMAX=None,
#         decay=0.999,
#         center=True,
#         scale=False,
#         epsilon=0.001,
#         activation_fn=None,
#         param_initializers=None,
#         is_training=True,
#         reuse=None,
#         variables_collections=None,
#         outputs_collections=None,
#         trainable=True,
#         data_format=DATA_FORMAT_NHWC,
#         zero_debias_moving_mean=False,
#         scope=None):
#         def _fused_batch_norm_training():
#         def _fused_batch_norm_inference():
#             def _delay_updates():
# class GRUCell(RNNCell):


# Path: ops/fops.py
import tensorflow as tf
import numpy as np
from tensorflow.python.ops.math_ops import sigmoid
from tensorflow.python.ops.math_ops import tanh
from tensorflow.contrib.rnn.python.ops import core_rnn_cell_impl
from ops import ops

try:
    xrange
except NameError:
    xrange = range
_linear = ops._linear
RNNCell = tf.contrib.rnn.RNNCell
LSTMStateTuple = tf.contrib.rnn.LSTMStateTuple


def shuttleNet(inputs, n_steps, num_mem, mem_dim,
            num_round,
            echocell,
            lstm_type="encell",
            activation=tf.tanh,
            num_frames=None,
            scope=None,
            reuse=None):
    with tf.variable_scope(scope, 'LSTM', [inputs], reuse=reuse):
        if lstm_type == "encell":
            input_shape = inputs.get_shape()
            inputs = tf.reshape(inputs, [input_shape[0].value, -1])
            batch_size = int(input_shape[0].value / n_steps)
            if echocell == "BASIC":
                cell = tf.contrib.rnn.BasicLSTMCell(mem_dim, forget_bias=1.0,
                                                    state_is_tuple=False,
                                                    activation=activation)
            elif echocell == "LSTM":
                cell = tf.contrib.rnn.LSTMCell(mem_dim, state_is_tuple=False,
                                               activation=activation)
            elif echocell == "GRU":

                cell = ops.GRUCell(mem_dim, activation=activation)