function batchFlatten(x) {
	  if (x.rank <= 1) {
	    throw new ValueError("batchFlatten requires a minimum rank of 2. Got rank: " + x.rank + ".");
	  }

	  var newShape = [x.shape[0], arrayProd(x.shape, 1)];
	  return x.reshape(newShape);
	}
Turn a nD tensor into a 2D tensor with same 0th dimension.
In other words, it flattens each data samples of a batch.

@param x The tensor to flatten. The rank of this tensor is required to be 2
  or higher.
@return The result of the flattening.