I don’t think this behavior is specific to transforms.ToTensor(), but it seems that each valid object would return True in this condition:
if nn.Linear(1, 1):
    print('True')

if logging.Logger(name='test'):
    print('True')