Fixed size_to_dim enforce

Summary: Fixed Caffe2Enforce in size_to_dim() so that it works even if k is same as the number of dimensions in the tensor.

Reviewed By: salexspb

Differential Revision: D5893264

fbshipit-source-id: 525ea263f5e21e197c7010e1c66501355b8027c8
diff --git a/caffe2/core/tensor.h b/caffe2/core/tensor.h
index c31676d..7df4837 100644
--- a/caffe2/core/tensor.h
+++ b/caffe2/core/tensor.h
@@ -47,7 +47,7 @@
 
 // Product of all dims up to
 inline TIndex size_to_dim_(int k, vector<TIndex> dims) {
-  CAFFE_ENFORCE(k < dims.size());
+  CAFFE_ENFORCE(k <= dims.size());
   TIndex r = 1;
   for (int i = 0; i < k; ++i) {
     r *= dims[i];