Skip to content

Issue when running code  #24

Description

@rakesh903

Hi,
I am getting error when I am trying to train the model.

Below is the error.

Traceback (most recent call last):
File "D:/Projects/ML/DeepL/NLPLSTM/lstm/lst.py", line 234, in
nextBatch, nextBatchLabels = getTrainBatch()
File "D:/Projects/ML/DeepL/NLPLSTM/lstm/lst.py", line 170, in getTrainBatch
arr[i] = ids[num-1:num]
ValueError: could not broadcast input array from shape (0,250) into shape (250)

Code:

def getTrainBatch():
labels = []
arr = np.zeros([batchSize, maxSeqLength])
for i in range(batchSize):
if i % 2 == 0:
num = randint(1,11499)
labels.append([1,0])
else:
num = randint(13499,24999)
labels.append([0,1])
arr[i] = ids[num-1:num]
return arr, labels

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