I am reading a single  image
    import torchvision.transforms as transforms    
    img = misc.imread(path)
    #<type 'numpy.ndarray'>
    #shape (256, 256)
    #then I change shape to (256,256,1)
    img = img[:,:,np.newaxis]
    toPIL = transforms.ToPILImage(mode='L')
    img = toPIL(img)

Getting this complain:
toPIL = transforms.ToPILImage(mode='L')
TypeError: object() takes no parameters

Not sure how to set mode in transforms.ToPILImage. if there is no way to manually set this, how should I read 1 channel image?