You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def get_entity(x,y,id2tag):
entity=""
res=[]
for i in range(len(x)): #for every sen
for j in range(len(x[0])): #for every word
...
...
这两个for循环中第一个是没问题的,因为统一batchsize大小了,但第二个for循环就有问题了,
因为x[0]的大小可能会大于60 这里没有做cut操作,因此j会大于60 导致y[i][j]数组越界,希望楼主可以更改一下。加上一个判断
for i in range(len(x)): #for every sen
if len(x[0]) > 60:
num = 60
else:
num = len(x[0])
for j in range(num): #for every word
这样都保证为60,就不会出现y[i][j]数组越界的问题了额
The text was updated successfully, but these errors were encountered:
def get_entity(x,y,id2tag):
entity=""
res=[]
for i in range(len(x)): #for every sen
for j in range(len(x[0])): #for every word
...
...
这两个for循环中第一个是没问题的,因为统一batchsize大小了,但第二个for循环就有问题了,
因为x[0]的大小可能会大于60 这里没有做cut操作,因此j会大于60 导致y[i][j]数组越界,希望楼主可以更改一下。加上一个判断
for i in range(len(x)): #for every sen
if len(x[0]) > 60:
num = 60
else:
num = len(x[0])
for j in range(num): #for every word
这样都保证为60,就不会出现y[i][j]数组越界的问题了额
The text was updated successfully, but these errors were encountered: