Created
February 9, 2019 04:01
-
-
Save eigenfoo/4737fd9e891f6495d61ddb9112136c93 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!bin/python | |
import numpy as np | |
batch_size = 32 | |
image_height = 256 | |
image_width = 256 | |
num_channels = 3 | |
# You can think of multi-dimensional arrays (a.k.a. ndarrays or tensors) as | |
# nested list comprehensions. | |
x = [[[[np.random.randint(255) for _ in range(num_channels)] | |
for _ in range(image_width)] | |
for _ in range(image_height)] | |
for _ in range(batch_size)] | |
x = np.array(x) | |
assert x.shape == (batch_size, image_height, image_width, num_channels) | |
# This might seem trivial but it gives us a systematic way of thinking about | |
# high-dimensional arrays. There are two things to understand: what one | |
# particular value looks like, and how these values are arranged together. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment