In summary TensorFlow uses the following equation for 'SAME' vs 'VALID'
SAME Padding, the output height and width are computed as:
out_height
= ceil(float(in_height) / float(strides[1]))
out_width
= ceil(float(in_width) / float(strides[2]))
VALID Padding, the output height and width are computed as:
out_height
= ceil(float(in_height - filter_height + 1) / float(strides[1]))
out_width
= ceil(float(in_width - filter_width + 1) / float(strides[2]))
https://www.tensorflow.org/api_guides/python/nn#Convolution