Last active
June 26, 2020 22:42
-
-
Save mfitton/face08073f636ded7196d96710ca9eb2 to your computer and use it in GitHub Desktop.
blog snippit 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i, x in enumerate(np.linspace(S[0], S[2], w)): | |
for j, y in enumerate(np.linspace(S[1], S[3], h)): | |
coords.append((i, j)) | |
next_task_xys.append((x, y)) | |
if len(next_task_xys) == CHUNK_SIZE: | |
results.append( | |
trace_rays_with_bounces.remote(next_task_xys) | |
) | |
next_task_xys = [] | |
if next_task_xys: | |
results.append(trace_rays_with_bounces.remote(next_task_xys)) | |
flat_results = chain.from_iterable(ray.get(results)) | |
for coord, result in zip(coords, flat_results): | |
i, j = coord | |
img[h - j - 1, i, :] = result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment