lib/roi_data_layer/collate_minibatch.py
def collate_minibatch(list_of_inputs):
    """Stack samples seperately and return a list of minibatches
    A batch contains NUM_GPUS minibatches and image size in different minibatch may be different.
    Hence, we need to stack smaples from each minibatch seperately.
    """
    if isinstance(list_of_inputs[0], torch.Tensor):
        list_of_inputs = check_pad_tensor_data(list_of_inputs)
        out = None
        return torch.stack(list_of_inputs, 0, out=out)
    elif isinstance(list_of_inputs[0], list):
        transposed = zip(*list_of_inputs)
        return [collate_minibatch(b) for b in transposed]
    elif isinstance(list_of_inputs[0], tuple):
        transposed = zip(*list_of_inputs)
        return [collate_minibatch(b) for b in transposed]
    else:
        return default_collate(list_of_inputs)
Stack samples seperately and return a list of minibatches
    A batch contains NUM_GPUS minibatches and image size in different minibatch may be different.
    Hence, we need to stack smaples from each minibatch seperately.
    
Stack samples seperately and return a list of minibatches
A batch contains NUM_GPUS minibatches and image size in different minibatch may be different.
Hence, we need to stack smaples from each minibatch seperately.
Stack samples seperately and return a list of minibatches A batch contains NUM_GPUS minibatches and image size in different minibatch may be different . Hence we need to stack smaples from each minibatch seperately .
def collate_minibatch(list_of_inputs):
    if isinstance(list_of_inputs[0], torch.Tensor):
        list_of_inputs = check_pad_tensor_data(list_of_inputs)
        out = None
        return torch.stack(list_of_inputs, 0, out=out)
    elif isinstance(list_of_inputs[0], list):
        transposed = zip(*list_of_inputs)
        return [collate_minibatch(b) for b in transposed]
    elif isinstance(list_of_inputs[0], tuple):
        transposed = zip(*list_of_inputs)
        return [collate_minibatch(b) for b in transposed]
    else:
        return default_collate(list_of_inputs)
def collate_minibatch ( list_of_inputs ) : if isinstance ( list_of_inputs [ 0 ] , torch . Tensor ) : list_of_inputs = check_pad_tensor_data ( list_of_inputs ) out = None return torch . stack ( list_of_inputs , 0 , out = out ) elif isinstance ( list_of_inputs [ 0 ] , list ) : transposed = zip ( * list_of_inputs ) return [ collate_minibatch ( b ) for b in transposed ] elif isinstance ( list_of_inputs [ 0 ] , tuple ) : transposed = zip ( * list_of_inputs ) return [ collate_minibatch ( b ) for b in transposed ] else : return default_collate ( list_of_inputs )
Stack samples seperately and return a list of minibatches
A batch contains NUM_GPUS minibatches and image size in different minibatch may be different.
Stack samples seperately and return a list of minibatches A batch contains NUM_GPUS minibatches and image size in different minibatch may be different .
"""Stack samples seperately and return a list of minibatches
    A batch contains NUM_GPUS minibatches and image size in different minibatch may be different.
    Hence, we need to stack smaples from each minibatch seperately.
    """
list_of_inputs