chickenbestlover / RNN-Time-series-Anomaly-Detection

RNN based Time-series Anomaly detector model implemented in Pytorch.
Apache License 2.0
1.17k stars 316 forks source link

problem with tensor's view? #2

Closed mckeown12 closed 5 years ago

mckeown12 commented 6 years ago

I am attempting to run the following:

<python 1_train_predictor.py --data nyc_taxi --filename nyc_taxi.pkl Here is the traceback:

Traceback (most recent call last): File "1_train_predictor.py", line 322, in <module> train(args,model,train_dataset,epoch) File "1_train_predictor.py", line 230, in train loss1 = criterion(outSeq1.view(args.batch_size,-1), targetSeq.view(args.batch_size,-1)) RuntimeError: invalid argument 2: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Call .contiguous() before .view(). at /Users/soumith/code/builder/wheel/pytorch-src/aten/src/TH/generic/THTensor.cpp:280

Any ideas?

chickenbestlover commented 6 years ago

Since I do not get the error on my computer, I have no idea why the error occurred. But contiguous error is easy to fix. try this: loss1 = criterion(outSeq1.contiguous().view(args.batch_size,-1), targetSeq.contiguous().view(args.batch_size,-1))

jcardenaslie commented 6 years ago

@chickenbestlover The fix worked for me. Thank you!

mckeown12 commented 6 years ago

Me as well. Thanks.

On Mon, Jun 25, 2018, 4:25 AM jcardenaslie notifications@github.com wrote:

@chickenbestlover https://github.com/chickenbestlover The fix worked for me. Thank you!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chickenbestlover/RNN-Time-series-Anomaly-Detection/issues/2#issuecomment-399872500, or mute the thread https://github.com/notifications/unsubscribe-auth/ACKCxclsooDwlo36c-CcuGfeMLiAog0Fks5uAJ6MgaJpZM4UxRno .