(self, in_tensor, out_tensor, mask)
Create a new minibatch of ticker priority sort task data.

        Arguments:
            in_tensor: device buffer holding inputs
            out_tensor: device buffer holding outputs
            mask: device buffer for the output mask
Create a new minibatch of ticker priority sort task data.
Create a new minibatch of ticker priority sort task data .
def synthesize(self, in_tensor, out_tensor, mask):

        """
        Create a new minibatch of ticker priority sort task data.

        Arguments:
            in_tensor: device buffer holding inputs
            out_tensor: device buffer holding outputs
            mask: device buffer for the output mask
        """

        # All sequences in a minibatch are the same length for convenience
        seq_len = np.random.randint(1, self.seq_len_max + 1)
        time_steps = self.time_steps_func(seq_len)

        # Get the minibatch specific numpy buffers
        inputs, outputs = super(PrioritySortTask, self).fetch_io(time_steps)

        # Set the start bit
        inputs[-3, :self.be.bsz] = 1

        # Generate the sequence to be copied
        seq = np.random.randint(2,
                                size=(self.nin,
                                      seq_len * self.be.bsz)).astype(float)

        # Zero out the start, stop, and priority channels
        seq[-3:, :] = 0

        # Generate the scalar priorities and put them in seq
        priorities = np.random.uniform(-1, 1, size=(seq_len * self.be.bsz,))
        seq[-1, :] = priorities

        # Set the stop bit
        stop_loc = self.be.bsz * (seq_len + 1)
        inputs[-2, stop_loc:stop_loc + self.be.bsz] = 1

        # Place the actual sequence to copy in inputs
        inputs[:, self.be.bsz:stop_loc] = seq

        # sort the sequences
        for i in range(self.be.bsz):
            # for every sequence in the batch

            # x <- every column in the sequence
            x = seq[:, i::self.be.bsz]

            # sort that set of columns by elt in the last row (the priority)
            x = x[:, x[-1, :].argsort()]

            # put those columns back into minibatch in the right places
            seq[:, i::self.be.bsz] = x

        outputs[:, self.be.bsz * (seq_len + 2):] = seq[:self.nout, :]

        # Fill the device minibatch buffers
        super(PrioritySortTask, self).fill_buffers(time_steps, inputs, outputs,
                                                   in_tensor, out_tensor, mask)
def synthesize ( self , in_tensor , out_tensor , mask ) : # All sequences in a minibatch are the same length for convenience seq_len = np . random . randint ( 1 , self . seq_len_max + 1 ) time_steps = self . time_steps_func ( seq_len ) # Get the minibatch specific numpy buffers inputs , outputs = super ( PrioritySortTask , self ) . fetch_io ( time_steps ) # Set the start bit inputs [ - 3 , : self . be . bsz ] = 1 # Generate the sequence to be copied seq = np . random . randint ( 2 , size = ( self . nin , seq_len * self . be . bsz ) ) . astype ( float ) # Zero out the start, stop, and priority channels seq [ - 3 : , : ] = 0 # Generate the scalar priorities and put them in seq priorities = np . random . uniform ( - 1 , 1 , size = ( seq_len * self . be . bsz , ) ) seq [ - 1 , : ] = priorities # Set the stop bit stop_loc = self . be . bsz * ( seq_len + 1 ) inputs [ - 2 , stop_loc : stop_loc + self . be . bsz ] = 1 # Place the actual sequence to copy in inputs inputs [ : , self . be . bsz : stop_loc ] = seq # sort the sequences for i in range ( self . be . bsz ) : # for every sequence in the batch # x <- every column in the sequence x = seq [ : , i : : self . be . bsz ] # sort that set of columns by elt in the last row (the priority) x = x [ : , x [ - 1 , : ] . argsort ( ) ] # put those columns back into minibatch in the right places seq [ : , i : : self . be . bsz ] = x outputs [ : , self . be . bsz * ( seq_len + 2 ) : ] = seq [ : self . nout , : ] # Fill the device minibatch buffers super ( PrioritySortTask , self ) . fill_buffers ( time_steps , inputs , outputs , in_tensor , out_tensor , mask )