(self, x, y)
return x, y, lengths
Pads the stories in a batch to the size of the longest one

        :param x:
        :param y:
        :return:
Pads the stories in a batch to the size of the longest one
Pads the stories in a batch to the size of the longest one
def pad_stories(self, x, y):
        """
        Pads the stories in a batch to the size of the longest one

        :param x:
        :param y:
        :return:
        """
        lengths = [len(story) for story in x]
        max_length = np.max(lengths)

        # padding the stories to the max length
        for i, story in enumerate(x):
            padding = bAbITask.to_onehot(np.ones(max_length - len(story)), self.vector_size)
            if len(padding) > 0:
                x[i] = np.vstack((x[i], padding))
                y[i] = np.vstack((y[i], padding))
        x = np.array(x)
        y = np.array(y)
        return x, y, lengths
def pad_stories ( self , x , y ) : lengths = [ len ( story ) for story in x ] max_length = np . max ( lengths ) # padding the stories to the max length for i , story in enumerate ( x ) : padding = bAbITask . to_onehot ( np . ones ( max_length - len ( story ) ) , self . vector_size ) if len ( padding ) > 0 : x [ i ] = np . vstack ( ( x [ i ] , padding ) ) y [ i ] = np . vstack ( ( y [ i ] , padding ) ) x = np . array ( x ) y = np . array ( y ) return x , y , lengths