Are you using torchvision-0.1.9? It used to determine mode from the numpy type. Snippet from my installation (transforms.py:114-121):
if npimg.dtype == np.uint8:
    mode = 'L'
if npimg.dtype == np.int16:
    mode = 'I;16'
if npimg.dtype == np.int32:
    mode = 'I'
elif npimg.dtype == np.float32:
    mode = 'F'