Skip to content

Runtime error running example #45

@kb1ooo

Description

@kb1ooo

Just trying one of the ECG examples and getting a runtime error. I'm running pytorch 1.5.

$ python 1_train_predictor.py --data ecg --filename chfdb_chf01_275.pkl --emsize 128 --nhid 128 --save_fig --epoch 600
=> Start training from scratch
-----------------------------------------------------------------------------------------
Namespace(augment=True, batch_size=64, bptt=50, clip=10, data='ecg', device='cuda', dropout=0.2, emsize=128, epochs=600, eval_batch_size=64, filename='chfdb_chf01_275.pkl', log_interval=10, lr=0.0002, model='LSTM', nhid=128, nlayers=2, prediction_window_size=10, pretrained=False, res_connection=False, resume=False, save_fig=True, save_interval=10, seed=1111, teacher_forcing_ratio=0.7, tied=False, weight_decay=0.0001)
-----------------------------------------------------------------------------------------
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/home/marc/dev/RNN-Time-series-Anomaly-Detection/1_train_predictor.py in <module>
    318 
    319             epoch_start_time = time.time()
--> 320             train(args,model,train_dataset,epoch)
    321             val_loss = evaluate(args,model,test_dataset)
    322             print('-' * 89)

/home/marc/dev/RNN-Time-series-Anomaly-Detection/1_train_predictor.py in train(args, model, train_dataset, epoch)
    226             outSeq1 = torch.cat(outVals,dim=0)
    227             hids1 = torch.cat(hids1,dim=0)
--> 228             loss1 = criterion(outSeq1.view(args.batch_size,-1), targetSeq.view(args.batch_size,-1))
    229 
    230             '''Loss2: Teacher forcing loss'''

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions