示例#1
0
def sample_point_set_projector(max_index):
    index = np.random.randint(0, max_index // 2)
    value = np.random.uniform(-4, 4, 1)
    value2 = np.random.uniform(-4, 4, 1)
    return set_projection.ProjectOntoAxis({
        2 * index: value,
        2 * index + 1: value2,
    })
示例#2
0
def create_set_projection(
        version='point',
        axis_idx_to_value=None,
        a_axis_to_b_axis=None,
):
    if version == 'project_onto_axis':
        for k in axis_idx_to_value:
            if axis_idx_to_value[k] is None:
                axis_idx_to_value[k] = np.random.uniform(-4, 4, 1)
        return sp.ProjectOntoAxis(axis_idx_to_value)
    elif version == 'move_a_to_b':
        return sp.MoveAtoB(a_axis_to_b_axis)
    else:
        raise ValueError(version)
示例#3
0
def sample_axis_set_projector(max_index):
    index = np.random.randint(0, max_index // 2)
    value = np.random.uniform(-4, 4, 1)
    return set_projection.ProjectOntoAxis({index: value})