def test_random_color_c(degrees=(0.1, 1.9), plot=False, run_golden=True):
    '\n    Test Cpp RandomColor\n    '
    logger.info('test_random_color_op')
    original_seed = config_get_set_seed(10)
    original_num_parallel_workers = config_get_set_num_parallel_workers(1)
    data1 = ds.TFRecordDataset(C_DATA_DIR, C_SCHEMA_DIR, columns_list=['image'], shuffle=False)
    data2 = ds.TFRecordDataset(C_DATA_DIR, C_SCHEMA_DIR, columns_list=['image'], shuffle=False)
    if (degrees is None):
        c_op = vision.RandomColor()
    else:
        c_op = vision.RandomColor(degrees)
    data1 = data1.map(operations=[vision.Decode()], input_columns=['image'])
    data2 = data2.map(operations=[vision.Decode(), c_op], input_columns=['image'])
    image_random_color_op = []
    image = []
    for (item1, item2) in zip(data1.create_dict_iterator(num_epochs=1, output_numpy=True), data2.create_dict_iterator(num_epochs=1, output_numpy=True)):
        actual = item1['image']
        expected = item2['image']
        image.append(actual)
        image_random_color_op.append(expected)
    if run_golden:
        filename = 'random_color_op_02_result.npz'
        save_and_check_md5(data2, filename, generate_golden=GENERATE_GOLDEN)
    if plot:
        visualize_list(image, image_random_color_op)
    ds.config.set_seed(original_seed)
    ds.config.set_num_parallel_workers(original_num_parallel_workers)
Test Cpp RandomColor
def test_random_color_c(degrees=(0.1, 1.9), plot=False, run_golden=True):
    '\n    \n    '
    logger.info('test_random_color_op')
    original_seed = config_get_set_seed(10)
    original_num_parallel_workers = config_get_set_num_parallel_workers(1)
    data1 = ds.TFRecordDataset(C_DATA_DIR, C_SCHEMA_DIR, columns_list=['image'], shuffle=False)
    data2 = ds.TFRecordDataset(C_DATA_DIR, C_SCHEMA_DIR, columns_list=['image'], shuffle=False)
    if (degrees is None):
        c_op = vision.RandomColor()
    else:
        c_op = vision.RandomColor(degrees)
    data1 = data1.map(operations=[vision.Decode()], input_columns=['image'])
    data2 = data2.map(operations=[vision.Decode(), c_op], input_columns=['image'])
    image_random_color_op = []
    image = []
    for (item1, item2) in zip(data1.create_dict_iterator(num_epochs=1, output_numpy=True), data2.create_dict_iterator(num_epochs=1, output_numpy=True)):
        actual = item1['image']
        expected = item2['image']
        image.append(actual)
        image_random_color_op.append(expected)
    if run_golden:
        filename = 'random_color_op_02_result.npz'
        save_and_check_md5(data2, filename, generate_golden=GENERATE_GOLDEN)
    if plot:
        visualize_list(image, image_random_color_op)
    ds.config.set_seed(original_seed)
    ds.config.set_num_parallel_workers(original_num_parallel_workers)