function getReshapedPermuted(inputShape, blockShape, prod, batchToSpace) {
	  if (batchToSpace === void 0) {
	    batchToSpace = true;
	  }

	  var reshapedPermuted = [];

	  if (batchToSpace) {
	    reshapedPermuted.push(inputShape[0] / prod);
	  } else {
	    reshapedPermuted.push(inputShape[0] * prod);
	  }

	  for (var i = 1; i < inputShape.length; ++i) {
	    if (i <= blockShape.length) {
	      if (batchToSpace) {
	        reshapedPermuted.push(blockShape[i - 1] * inputShape[i]);
	      } else {
	        reshapedPermuted.push(inputShape[i] / blockShape[i - 1]);
	      }
	    } else {
	      reshapedPermuted.push(inputShape[i]);
	    }
	  }

	  return reshapedPermuted;
	}
Gets the shape of the reshaped and permuted input Tensor before any cropping
is applied.  The new shape will be:

[batch / prod(blockShape),inputShape[1] * blockShape[0], ...,
inputShape[M] * blockShape[M-1],inputShape[M+1], ..., inputShape[N-1]]

See step 3: https://www.tensorflow.org/api_docs/python/tf/batch_to_space_nd