intel / ai-reference-models

Intel® AI Reference Models: contains Intel optimizations for running deep learning workloads on Intel® Xeon® Scalable processors and Intel® Data Center GPUs
Apache License 2.0
674 stars 220 forks source link

correct_k = correct[:k].view(-1).float().sum(0, keepdim=True) RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead. #85

Open arthw opened 3 years ago

arthw commented 3 years ago

When pytorch is 1.7 in oneAPI AI toolkit, there is error in running case:

cd models/models/image_recognition/pytorch/common/
python main.py -d /home/wj/ImageNet/data/all -a resnet50 --epochs 100 --learning-rate 0.1  --print-freq 1 -b 64 –ipex
...

correct_k = correct[:k].view(-1).float().sum(0, keepdim=True)
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

view() is not supported and use reshape() to fix it.

sramakintel commented 5 months ago

@arthw can you try our latest optimzations https://www.intel.com/content/www/us/en/developer/articles/containers/cpu-reference-model-containers.html for pytorch rn50 model to see if this resolves your issue?