MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / __init__

Method __init__

tensorpack/predict/base.py:93–120  ·  view source on GitHub ↗

Args: input_tensors (list): list of names. output_tensors (list): list of names. return_input (bool): same as :attr:`PredictorBase.return_input`. sess (tf.Session): the session this predictor runs in. If None, will use the defa

(self, input_tensors, output_tensors,
                 return_input=False, sess=None)

Source from the content-addressed store, hash-verified

91 """ See Session.make_callable """
92
93 def __init__(self, input_tensors, output_tensors,
94 return_input=False, sess=None):
95 """
96 Args:
97 input_tensors (list): list of names.
98 output_tensors (list): list of names.
99 return_input (bool): same as :attr:`PredictorBase.return_input`.
100 sess (tf.Session): the session this predictor runs in. If None,
101 will use the default session at the first call.
102 Note that in TensorFlow, default session is thread-local.
103 """
104 def normalize_name(t):
105 if isinstance(t, six.string_types):
106 return get_op_tensor_name(t)[1]
107 return t
108
109 self.return_input = return_input
110 self.input_tensors = [normalize_name(x) for x in input_tensors]
111 self.output_tensors = [normalize_name(x) for x in output_tensors]
112 self.sess = sess
113
114 if sess is not None:
115 self._callable = sess.make_callable(
116 fetches=output_tensors,
117 feed_list=input_tensors,
118 accept_options=self.ACCEPT_OPTIONS)
119 else:
120 self._callable = None
121
122 def _do_call(self, dp):
123 assert len(dp) == len(self.input_tensors), \

Callers 1

__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected