GraphModifierHook

Hook class for automatic graph modification, which is used only in Estimator Training mode. After the hook class is added, the automatic graph modification function is enabled.

Parameter

Data Type

Mandatory/Optional

Description

dump_graph

bool

Optional

Whether to save the current TensorFlow computational graph. The default value is False.

modify_graph

bool

Optional

Whether to enable the automatic graph modification function. The default value is True.

Example

from mx_rec.graph.modifier import GraphModifierHook

# Define the data processing function.
def input_fn():
     pass

est.train(input_fn=lambda: input_fn(), hooks=[GraphModifierHook()])   # est is the created NPUEstimator object.