Exemple #1
0
 def __call__(self, *args):
     session = compat.tf_get_session()
     compat.tf_ensure_init_variables()
     try:
         if self._update_op:
             output_vals = session.run(
                 self._output_list + [self._update_op], feed_dict=dict(zip(self._inputs, args)))[:-1]
         else:
             output_vals = session.run(
                 self._output_list, feed_dict=dict(zip(self._inputs, args)))
         if isinstance(self._outputs, (list, tuple)):
             return output_vals
         else:
             return output_vals[0]
     except Exception as e:
         import traceback
         traceback.print_exc()
         import ipdb
         ipdb.set_trace()
Exemple #2
0
 def __call__(self, *args):
     session = compat.tf_get_session()
     compat.tf_ensure_init_variables()
     try:
         if self._update_op:
             output_vals = session.run(
                 self._output_list + [self._update_op],
                 feed_dict=dict(zip(self._inputs, args)))[:-1]
         else:
             output_vals = session.run(self._output_list,
                                       feed_dict=dict(
                                           zip(self._inputs, args)))
         if isinstance(self._outputs, (list, tuple)):
             return output_vals
         else:
             return output_vals[0]
     except Exception as e:
         import traceback
         traceback.print_exc()
         import ipdb
         ipdb.set_trace()
Exemple #3
0
def _tf_variable_set_value(self, val, borrow=None):
    tf_get_session().run(tf.assign(self, val))
Exemple #4
0
def _tf_variable_get_value(self, borrow=None):
    tf_ensure_init_variables()
    return tf_get_session().run(self)
Exemple #5
0
def _tf_variable_set_value(self, val, borrow=None):
    tf_get_session().run(tf.assign(self, val))
Exemple #6
0
def _tf_variable_get_value(self, borrow=None):
    tf_ensure_init_variables()
    return tf_get_session().run(self)