def eval(self, inp, feed_dict=None, session=None, tolist=False,
use_while_loop=True):
"""Evaluates this block on `inp` in a TF session.
Intended for testing and interactive development. If there are any
uninitialized variables, they will be initialized prior to evaluation.
Args:
inp: An input to the block.
feed_dict: A dictionary that maps `Tensor` objects to feed values.
session: The TF session to be used. Defaults to the default session.
tolist: A bool; whether to return (possibly nested) Python lists
in place of NumPy arrays.
use_while_loop: A bool; whether to use a `tf.while_loop` in evaluation
(default) or to unroll the loop. Provided for testing and debugging,
should not affect the result.
Returns:
The result of running the block. If `output_type` is tensor, then a
NumPy array (or Python list, if `tolist` is true). If a tuple, then a
tuple. If a sequence, then a list, or an instance of itertools.repeat
in the case of an infinite sequence. If metrics are defined then `eval`
returns a `(result, metrics)` tuple, where `metrics` is a dict mapping
metric names to NumPy arrays.
Raises:
ValueError: If `session` is none and no default session is registered.
If the block contains no TF tensors or ops then a session is not
required.
"""
# pylint: disable=protected-access
return tensorflow_fold.blocks.block_compiler.Compiler._interactive( # pylint: disable=line-too-long
self)._eval(inp, feed_dict, session, tolist, use_while_loop)
评论列表
文章目录