Skip to content

limit = l[0][0] - IndexError: index 0 is out of bounds for axis 0 with size 0  #15

Open
@stajilov

Description

@stajilov

What can be the root cause for this?

for m in range(Epochs):

    # Loop over training batches due to memory constraints:
    for n in range(0,round_exem,step):

        q2 = q[n:n+step]
        print(q2)
        s = q2.shape
        print(s)
        count = 0
        for i, sent in enumerate(a[n:n+step]):
            print("Sentence")
            print(sent)
            l = np.where(sent==3)  #  the position of the symbol EOS
            limit = l[0][0]
            count += limit + 1
  File "train_bot.py", line 188, in <module>
    limit = l[0][0]
IndexError: index 0 is out of bounds for axis 0 with size 0

I don't see any 3 for some reason

Sentence
[   1   31    5  640    8 2475    9    8  339    4    2    0    0    0
    0    0    0    0    0    0    0    0    0    0    0    0    0    0
    0    0    0    0    0    0    0    0    0    0    0    0    0    0
    0    0    0    0    0    0    0    0]

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