Hot_Embedding

The Hot_Embedding function is enabled by default and does not need to be configured.

Sample

This function is automatically enabled and does not need to be configured. To ensure that the function is successfully enabled, you need to enable the high-performance mode of the GatherV2 operator as follows:
  1. Pass the op_impl_mode.ini configuration item to the session. The code is as follows:
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    import tensorflow as tf
    session_config = tf.compat.v1.ConfigProto(allow_soft_placement=False, log_device_placement=False)
    session_config.gpu_options.allow_growth = True
    custom_op = session_config.graph_options.rewrite_options.custom_optimizers.add()
    # 1. Pass the operator configuration file path to the configuration item.
    custom_op.parameter_map["op_precision_mode"].s = tf.compat.as_bytes("op_impl_mode.ini")
    # 2. Create a graph.
    # 3. Pass the configuration to sess initialization.
    with tf.compat.v1.Session(config=sess_config) as sess:
    # 4. Training
    
  2. Create the op_impl_mode.ini file in the model path. The file content is as follows:
    1
    GatherV2=high_performance