added set_gpu_data to avoig memory trashing, implemented slicing in memory data layer