autonomousvision / convolutional_occupancy_networks

[ECCV'20] Convolutional Occupancy Networks
https://pengsongyou.github.io/conv_onet
MIT License
830 stars 113 forks source link

Add_key seems to be not doing what's the code is intended? #31

Closed b0ku1 closed 3 years ago

b0ku1 commented 3 years ago

Hi there, It seems like when calling add_key function, usually nothing is happening. add_key is defined as: `def add_key(base, new, base_name, new_name, device=None): ''' Add new keys to the given input

Args:
    base (tensor): inputs
    new (tensor): new info for the inputs
    base_name (str): name for the input
    new_name (str): name for the new info
    device (device): pytorch device
'''
if (new is not None) and (isinstance(new, dict)):
    if device is not None:
        for key in new.keys():
            new[key] = new[key].to(device)
    base = {base_name: base,
            new_name: new}
return base

Which means that only whennew` is a dictionary, things will happen. But when it's called in the code, for example here: https://github.com/autonomousvision/convolutional_occupancy_networks/blob/f44d413f8d455657a44c24d06163934c69141a09/src/conv_onet/training.py#L79 Are we expecting that data.get will return a dict? Else, the add_key will do nothing.

(PS: the documentation of add_key says new should be a tensor, but the code does something only when new is a dict)

Thanks.