예제 #1
0
파일: shift_gpu.py 프로젝트: surban/ml
def generate_data(x_len, s_len, n_samples, binary=False):
    data = generate_random_data(x_len, n_samples, binary=binary)
    shifts, shifts_hot = generate_shifts(s_len, n_samples)
    shifted = generate_shifted(data, shifts)
    return (gpuarray_to_garray(data), 
            gpuarray_to_garray(shifts_hot), 
            gpuarray_to_garray(shifted))
예제 #2
0
파일: shift_gpu.py 프로젝트: surban/ml
def generate_data_2d(width, height, n_samples, binary=False, with_hot=False, force_id=True):
    data = generate_random_data(width * height, n_samples, binary=binary)
    x_shifts, y_shifts, shifts = generate_shifts_2d(width, height, n_samples, with_hot=with_hot)
    if force_id:
        shifted = data
    else:
        shifted = generate_shifted_2d(data, x_shifts, y_shifts, width, height)
    return (gpuarray_to_garray(data),
            gpuarray_to_garray(shifts),
            gpuarray_to_garray(shifted))
예제 #3
0
파일: shift_gpu.py 프로젝트: surban/ml
def generate_id_data(x_len, n_samples, binary=False):
    data = generate_random_data(x_len, n_samples, binary=binary)
    return gpuarray_to_garray(data), gpuarray_to_garray(data)