Tensorflow's Debug (Debug) && tf.py_func() Tensorflow's Debug (Debug) and print variables

Several common methods:

1. Get the value of the variable through Session.run()

2. Use Tensorboard to view some visual statistics

3. Use tf.Print() and tf.Assert() to print variables

4. Use Python's debug tools: ipdb, pudb

5. Use tf.py_func() to insert custom printing code into the graph, tdb

6. Use the official debug tool: tfdbg

Its specific function description is to wrap a common Python function that accepts numpy arrays as input and output, so that this function can be used as a computing node OP on the TensorFlow computing graph.

py_func(
    func,
    inp,
    All,
    stateful=True,
    name=None
)

parameter:

    func: A Python function that accepts NumPy arrays as input and output, and the type and size of the array must match the size and data type of the Tensor used to connect the input and output.
    inp: List of input Tensors.
    Tout: List or tuple of output Tensor data types.
    stateful: state, boolean.
    name: The name of the node OP.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325019290&siteId=291194637