OrphanLookupKeySlicerHook

Passes an orphan key that cannot be found in the dataset during sparse table query, which extends the sparse table query function in automatic graph modification mode. If no operator of the target type is found, no splitting is performed.

This hook is used when automatic graph modification is enabled in NPUEstimator mode. It must be called before GraphModifierHook is called for automatic graph modification.

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
from mx_rec.graph import OrphanLookupKeySlicerHook, GraphModifierHook

def input_fn():
    """
    Define an Estimator input function yourself.
    """

orphan_slicer_hook = OrphanLookupKeySlicerHook()
modifier_hook = GraphModifierHook(modify_graph=params.modify_graph)
hooks_list = [orphan_slicer_hook, modifier_hook]

est = NPUEstimator(...)
est.train(input_fn=lambda: input_fn, hooks=npu_hooks_append(hooks_list))