Skip to content
Advertisement

Dataloader throwing error TypeError: new(): data must be a sequence (got map)

I am trying to implement bidirectional LSTM on time series data. The main file calls the dataloader to load the data for the model.

Main.py

JavaScript

data_loader.py

JavaScript

but I am unable to resolve the error TypeError: new(): data must be a sequence (got map)

Following message is being received in the terminal:

JavaScript

The input data is in the jason format (below is the partial data):

JavaScript

I researched and got that it might be issue with python 3 but I ran on python 2 but still facing the same issue. Please help me resolve the issue.

Advertisement

Answer

I haven’t looked or tried running all of your code, but at a glance, this line is clearly wrong

JavaScript

In python3, map() returns a map object, not a list. FloatTensor(..) expects the later, i.e. a list. Just cast all your map objects with list()

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement