Skip to content

Instantly share code, notes, and snippets.

@girija2204
Created July 23, 2020 03:34
Show Gist options
  • Save girija2204/4d3f33a887c9e1a55a6d543f27fd81c1 to your computer and use it in GitHub Desktop.
Save girija2204/4d3f33a887c9e1a55a6d543f27fd81c1 to your computer and use it in GitHub Desktop.
def normalize(image,label):
return tf.cast(image,tf.float32)/255.0, label
x, y = normalize([243,225,297],2)
x.numpy(), y
# (array([0.9529412 , 0.88235295, 1.1647059 ], dtype=float32), 2)
train_tensor_slices = train_tensor_slices.map(normalize).batch(128)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment