FDD/label_distillation_rr.py
def remap_targets(fixed_target, depth):
    """Only useful for cross-dataset scenarios - within dataset it does not remap it"""
    if int(max(fixed_target)) < depth:
        if args.source == "cifar10" or args.source == "cifar100" or args.source == "svhn":
            return fixed_target
        else:
            return fixed_target.long()
    else:
        remapped_targets = []
        mapping = {}
        max_index = 0
        for label in fixed_target:
            if int(label) in mapping:
                remapped_targets.append(mapping[int(label)])
            else:
                mapping[int(label)] = max_index
                max_index += 1
                remapped_targets.append(mapping[int(label)])
        if max_index > depth:
            raise('Too many labels to remap')
        return torch.Tensor(remapped_targets).long().to(device=device)
Only useful for cross-dataset scenarios - within dataset it does not remap it
Only useful for cross-dataset scenarios - within dataset it does not remap it
Only useful for cross - dataset scenarios - within dataset it does not remap it
def remap_targets(fixed_target, depth):
    if int(max(fixed_target)) < depth:
        if args.source == "cifar10" or args.source == "cifar100" or args.source == "svhn":
            return fixed_target
        else:
            return fixed_target.long()
    else:
        remapped_targets = []
        mapping = {}
        max_index = 0
        for label in fixed_target:
            if int(label) in mapping:
                remapped_targets.append(mapping[int(label)])
            else:
                mapping[int(label)] = max_index
                max_index += 1
                remapped_targets.append(mapping[int(label)])
        if max_index > depth:
            raise('Too many labels to remap')
        return torch.Tensor(remapped_targets).long().to(device=device)
def remap_targets ( fixed_target , depth ) : if int ( max ( fixed_target ) ) < depth : if args . source == "cifar10" or args . source == "cifar100" or args . source == "svhn" : return fixed_target else : return fixed_target . long ( ) else : remapped_targets = [ ] mapping = { } max_index = 0 for label in fixed_target : if int ( label ) in mapping : remapped_targets . append ( mapping [ int ( label ) ] ) else : mapping [ int ( label ) ] = max_index max_index += 1 remapped_targets . append ( mapping [ int ( label ) ] ) if max_index > depth : raise ( 'Too many labels to remap' ) return torch . Tensor ( remapped_targets ) . long ( ) . to ( device = device )
Only useful for cross-dataset scenarios - within dataset it does not remap it
Only useful for cross - dataset scenarios - within dataset it does not remap it
"""Only useful for cross-dataset scenarios - within dataset it does not remap it"""
fixed_target
depth