tensorflow-playground
tensorflow-playground copied to clipboard
Problem with generate_batch_cbow(data,batch_size, num_skips=2, skip_window=2)
ValueError: cannot copy sequence with size 4 to array axis with dimension 2.
Got a solution, but I did not check it for correctness. It involves making the mask for the sliding windows fit your dimensions.
Here is what i did
# move the sliding window
for i in range(batch_size):
mask = [0] * span
# taking context words equal to num_skips
for ns in range(0,num_skips):
posNumber = random.randint(0,span-1)
while (posNumber == skip_window or or mask[posNumber]== 1):
posNumber = random.randint(0,span-1)
mask[posNumber]=1