# Path: tensor_factorization/utils/SummaryHelpers.py
# class SummaryHelpers(object):
#     """
# 
#     """
#     @staticmethod
#     def activation_summary(x):
# 
#         """
#         Helper to create summaries for activations.
#         Creates a summary that provides a histogram of activations.
#         Creates a summary that measure the sparsity of activations.
#         Args:
#         x: Tensor
#         Returns:
#         nothing
#         """
#         tensor_name = x.op.name
#         tf.histogram_summary(tensor_name + '/activations', x)
#         tf.scalar_summary(tensor_name + '/sparsity', tf.nn.zero_fraction(x))


import tensorflow as tf
import abc
import numpy as np
from tensor_factorization.utils.SummaryHelpers import SummaryHelpers
        self.inputs_shape = parameters['inputs_shape']
        self.sp_hidden_shape = parameters['sp_hidden_shape']
        self.rec_hidden_shape = parameters['rec_hidden_shape']
        self.learning_rate = parameters['learning_rate']

        with tf.variable_scope(self.name):

            # variables holding spatial and recurrent weights and biases
            self.sp_enc_w = tf.Variable(tf.random_normal([self.inputs_shape, self.sp_hidden_shape], stddev=0.35),
                                        name="sp_enc_w")
            self.sp_enc_b = tf.Variable(tf.random_normal([self.sp_hidden_shape], stddev=0.35),
                                        name="sp_enc_b")
            self.sp_dec_w = tf.Variable(tf.random_normal([self.sp_hidden_shape, self.inputs_shape], stddev=0.35),
                                        name="sp_dec_w")
            self.sp_dec_b = tf.Variable(tf.random_normal([self.inputs_shape], stddev=0.35),
                                        name="sp_dec_b")
            self.rec_enc_w = tf.Variable(tf.random_normal([self.sp_hidden_shape, self.rec_hidden_shape], stddev=0.35),
                                         name="rec_enc_w")
            self.rec_enc_b = tf.Variable(tf.random_normal([self.rec_hidden_shape], stddev=0.35),
                                         name="rec_enc_b")
            self.rec_dec_w = tf.Variable(tf.random_normal([self.rec_hidden_shape, self.sp_hidden_shape], stddev=0.35),
                                         name="rec_dec_w")
            self.rec_dec_b = tf.Variable(tf.random_normal([self.sp_hidden_shape], stddev=0.35),
                                         name="rec_dec_b")

    def run(self, sess, inputs, state):
        with tf.variable_scope(self.name):
            # tensorflow OP spatial hidden
            sp_hidden = tf.nn.sigmoid(tf.matmul(inputs, self.sp_enc_w) + self.sp_enc_b,
                                      name="sp_hidden")

# Path: tensor_factorization/utils/SummaryHelpers.py
# class SummaryHelpers(object):
#     """
# 
#     """
#     @staticmethod
#     def activation_summary(x):
# 
#         """
#         Helper to create summaries for activations.
#         Creates a summary that provides a histogram of activations.
#         Creates a summary that measure the sparsity of activations.
#         Args:
#         x: Tensor
#         Returns:
#         nothing
#         """
#         tensor_name = x.op.name
#         tf.histogram_summary(tensor_name + '/activations', x)
#         tf.scalar_summary(tensor_name + '/sparsity', tf.nn.zero_fraction(x))


# Path: tensor_factorization/core_network/Layer.py
import tensorflow as tf
import abc
import numpy as np
from tensor_factorization.utils.SummaryHelpers import SummaryHelpers

        self.inputs_shape = parameters['inputs_shape']
        self.sp_hidden_shape = parameters['sp_hidden_shape']
        self.rec_hidden_shape = parameters['rec_hidden_shape']
        self.learning_rate = parameters['learning_rate']

        with tf.variable_scope(self.name):

            # variables holding spatial and recurrent weights and biases
            self.sp_enc_w = tf.Variable(tf.random_normal([self.inputs_shape, self.sp_hidden_shape], stddev=0.35),
                                        name="sp_enc_w")
            self.sp_enc_b = tf.Variable(tf.random_normal([self.sp_hidden_shape], stddev=0.35),
                                        name="sp_enc_b")
            self.sp_dec_w = tf.Variable(tf.random_normal([self.sp_hidden_shape, self.inputs_shape], stddev=0.35),
                                        name="sp_dec_w")
            self.sp_dec_b = tf.Variable(tf.random_normal([self.inputs_shape], stddev=0.35),
                                        name="sp_dec_b")
            self.rec_enc_w = tf.Variable(tf.random_normal([self.sp_hidden_shape, self.rec_hidden_shape], stddev=0.35),
                                         name="rec_enc_w")
            self.rec_enc_b = tf.Variable(tf.random_normal([self.rec_hidden_shape], stddev=0.35),
                                         name="rec_enc_b")
            self.rec_dec_w = tf.Variable(tf.random_normal([self.rec_hidden_shape, self.sp_hidden_shape], stddev=0.35),
                                         name="rec_dec_w")
            self.rec_dec_b = tf.Variable(tf.random_normal([self.sp_hidden_shape], stddev=0.35),
                                         name="rec_dec_b")

    def run(self, sess, inputs, state):
        with tf.variable_scope(self.name):
            # tensorflow OP spatial hidden
            sp_hidden = tf.nn.sigmoid(tf.matmul(inputs, self.sp_enc_w) + self.sp_enc_b,
                                      name="sp_hidden")

            SummaryHelpers.activation_summary(sp_hidden)