additional_utils/models.py
def parallel_forward(self, inputs, label_set='', **kwargs):
        """Multi-GPU Mult-size Evaluation

        Args:
            inputs: list of Tensors
        """
        if len(label_set) < 10:
            print('** MultiEvalModule parallel_forward phase: {} **'.format(label_set))
        self.nclass = len(label_set)
        inputs = [(input.unsqueeze(0).cuda(device),)
                  for input, device in zip(inputs, self.device_ids)]
        replicas = self.replicate(self, self.device_ids[:len(inputs)])
        kwargs = scatter(kwargs, target_gpus, dim) if kwargs else []
        if len(inputs) < len(kwargs):
            inputs.extend([() for _ in range(len(kwargs) - len(inputs))])
        elif len(kwargs) < len(inputs):
            kwargs.extend([{} for _ in range(len(inputs) - len(kwargs))])
        outputs = parallel_apply(replicas, inputs, label_set, kwargs)
        return outputs
Multi-GPU Mult-size Evaluation

        Args:
            inputs: list of Tensors
        
Multi-GPU Mult-size Evaluation
Multi - GPU Mult - size Evaluation
def parallel_forward(self, inputs, label_set='', **kwargs):
        if len(label_set) < 10:
            print('** MultiEvalModule parallel_forward phase: {} **'.format(label_set))
        self.nclass = len(label_set)
        inputs = [(input.unsqueeze(0).cuda(device),)
                  for input, device in zip(inputs, self.device_ids)]
        replicas = self.replicate(self, self.device_ids[:len(inputs)])
        kwargs = scatter(kwargs, target_gpus, dim) if kwargs else []
        if len(inputs) < len(kwargs):
            inputs.extend([() for _ in range(len(kwargs) - len(inputs))])
        elif len(kwargs) < len(inputs):
            kwargs.extend([{} for _ in range(len(inputs) - len(kwargs))])
        outputs = parallel_apply(replicas, inputs, label_set, kwargs)
        return outputs
def parallel_forward ( self , inputs , label_set = '' , ** kwargs ) : if len ( label_set ) < 10 : print ( '** MultiEvalModule parallel_forward phase: {} **' . format ( label_set ) ) self . nclass = len ( label_set ) inputs = [ ( input . unsqueeze ( 0 ) . cuda ( device ) , ) for input , device in zip ( inputs , self . device_ids ) ] replicas = self . replicate ( self , self . device_ids [ : len ( inputs ) ] ) kwargs = scatter ( kwargs , target_gpus , dim ) if kwargs else [ ] if len ( inputs ) < len ( kwargs ) : inputs . extend ( [ ( ) for _ in range ( len ( kwargs ) - len ( inputs ) ) ] ) elif len ( kwargs ) < len ( inputs ) : kwargs . extend ( [ { } for _ in range ( len ( inputs ) - len ( kwargs ) ) ] ) outputs = parallel_apply ( replicas , inputs , label_set , kwargs ) return outputs
Multi-GPU Mult-size Evaluation
Multi - GPU Mult - size Evaluation
"""Multi-GPU Mult-size Evaluation

        Args:
            inputs: list of Tensors
        """
self
inputs
list of Tensors
list of Tensors
label_set