0
opt/conda/lib/python3.6/site-packages/keras/callbacks.py in on_batch_end(self, batch, logs)
    234             else:
    235                 if k in self.totals:
--> 236                     self.totals[k] += v * batch_size
    237                 else:
    238                     self.totals[k] = v * batch_size

ValueError: operands could not be broadcast together with shapes (32,) (20,) (32,) 

This error pops up midway through training - it seems to be at batch end. Any body have pointers to what shapes are being referred to here?

Per Kyle's request :

class batch_creator(Sequence):

    def __init__(self, data, batch_size,window_size, V):
        self.data = data

        self.batch_size = batch_size

    def __len__(self):
        return int(len(self.data) / float(self.batch_size))

    def __getitem__(self, idx):
        batch_x = self.data[idx*self.batch_size :(idx +1)* self.batch_size]

        #if idx % self.batch_size==0:
        #print(idx)
        #words=[]
       # contexts=[]

        x,z,y =next(generate_data(batch_x, window_size, V))

        x = np.array(x,dtype=np.int32)
        z = np.array(z,dtype=np.int32)
        y= np.array(y,dtype=np.int32)
        #print(x)
        return [x,y]

"""Instantiate Batchmanager"""
model.fit_generator(batch_manager,epochs=5)
pythOnometrist
  • 6,531
  • 6
  • 30
  • 50

0 Answers0