Repository: pytorch
Issue: Conversion of 2d and 4d vectors in c++ to torch::tensor doesn't have the right data
Labels: module: cpp,triaged

### 🐛 Describe the bug


I'm trying to convert these two vectors to torch tensor but the output doesn't have the right data:
`
auto input_options = torch::TensorOptions().dtype(torch::kInt32);
`
`
auto inputs = torch::from_blob(vec.data(), {1, 10, 194, 144}, input_options);
`
output:
`
..Columns 13 to 18 -8.0412e+08  9.1974e+08  4.9000e+01  0.0000e+00  1.6578e+09  2.1909e+04
  1.6578e+09  2.1909e+04  1.6581e+09  2.1909e+04  1.6559e+09  2.1909e+04
  1.8698e+09  1.9702e+09  7.5708e+08  1.7000e+09  1.9199e+09  0.0000e+00
  1.9704e+09  1.8524e+09  1.7017e+09  5.3978e+08  1.9366e+09  5.4103e+08..
`
also
`
std::vector<std::vector <int>> indx1={{126, 22}, {166, 102}, {46, 46}, {166, 54} };
`
`
auto indx_options = torch::TensorOptions().dtype(torch::kInt32);
`
`
 auto indx = torch::from_blob(indx1.data(), { indx1.size(),2}, indx_options);
`
output:
`
 1.1586e+09  2.2036e+04
 1.1586e+09  2.2036e+04
 1.1586e+09  2.2036e+04
 1.1586e+09  2.2036e+04
[ CPUIntType{4,2} ]
`


### Versions

PyTorch version: 2.1.0
Is debug build: False
CUDA used to build PyTorch: Could not collect
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.3 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: 14.0.0-1ubuntu1.1
CMake version: version 3.28.1
Libc version: glibc-2.35

Python version: 3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-6.2.0-36-generic-x86_64-with-glibc2.35
Is CUDA available: False
CUDA runtime version: 11.5.119
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Address sizes:                      39 bits physical, 48 bits virtual
Byte Order:                         Little Endian
CPU(s):                             8
On-line CPU(s) list:                0-7
Vendor ID:                          GenuineIntel
Model name:                         Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
CPU family:                         6
Model:                              126
Thread(s) per core:                 2
Core(s) per socket:                 4
Socket(s):                          1
Stepping:                           5
CPU max MHz:                        3900.0000
CPU min MHz:                        400.0000
BogoMIPS:                           2995.20
Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves split_lock_detect dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid fsrm md_clear flush_l1d arch_capabilities
Virtualization:                     VT-x
L1d cache:                          192 KiB (4 instances)
L1i cache:                          128 KiB (4 instances)
L2 cache:                           2 MiB (4 instances)
L3 cache:                           8 MiB (1 instance)
NUMA node(s):                       1
NUMA node0 CPU(s):                  0-7
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit:        KVM: Mitigation: VMX disabled
Vulnerability L1tf:                 Not affected
Vulnerability Mds:                  Not affected
Vulnerability Meltdown:             Not affected
Vulnerability Mmio stale data:      Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed:             Mitigation; Enhanced IBRS
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds:                Mitigation; Microcode
Vulnerability Tsx async abort:      Not affected

Versions of relevant libraries:
[pip3] numpy==1.26.2
[pip3] onnx==1.15.0
[pip3] onnxruntime-gpu==1.16.3
[pip3] onnxscript==0.1.0.dev20231212
[pip3] torch==2.1.1
[pip3] triton==2.1.0
[conda] blas                      1.0                         mkl  
[conda] cudatoolkit               8.0                           3    shuangnan
[conda] mkl                       2023.1.0         h213fc3f_46344  
[conda] mkl-service               2.4.0           py311h5eee18b_1  
[conda] mkl_fft                   1.3.8           py311h5eee18b_0  
[conda] mkl_random                1.2.4           py311hdb19cb5_0  
[conda] numpy                     1.26.2          py311h08b1b3b_0  
[conda] numpy-base                1.26.2          py311hf175353_0  
[conda] pytorch                   2.1.0           cpu_py311h6d93b4c_0  
[conda] torch                     2.1.1                    pypi_0    pypi
[conda] triton                    2.1.0                    pypi_0    pypi

cc @jbschlosser