'Dynamically grow or shrink the number of time steps to perform
single time step fprop during inference.'

def switch_mode(self, inference):

    hasLUT = isinstance(self.layers[0], LookupTable)
    cur_steps = (self.in_shape[0] if hasLUT else self.in_shape[1])
    if (not inference):
        old_size = cur_steps
        new_size = self.full_steps
    else:
        old_size = cur_steps
        new_size = 1
    if (old_size != new_size):
        if hasLUT:
            in_obj = (new_size, 1)
            self.layers[0].inputs = None
            self.layers[0].outputs_t = None
        else:
            in_obj = (self.out_shape[0], new_size)
        self.configure(in_obj=in_obj)
        for l in self.layers:
            if l.owns_output:
                l.outputs = None
        self.allocate(shared_outputs=None)
        for l in self.layers:
            l.name += "'"
