Added check to make sure the variable is of the user specified size after removing leading broadcastable dimensions.