Hello, I’m trying to use Posit<8,1> format in Pytorch with SoftPosit.
To start, I’m trying to load MNIST dataset and then, cast it to Posit8. My problem comes when I try to cast the X train to sp.posit8, apparently the program do it well, but after 2 minutes it gets blocked and after some time appears a message saying “kernel dead”.
This is the code I use:
Downloading the datasets in Pytorch format:
# define transforms
# transforms.ToTensor() automatically scales the images to [0,1] range
transforms = transforms.Compose([transforms.Resize((32, 32)),
                                 transforms.ToTensor()]) 

# download and create datasets
train_dataset = datasets.MNIST(root='mnist_data', 
                               train=True, 
                               transform=transforms,
                               download=True) 

valid_dataset = datasets.MNIST(root='mnist_data', 
                               train=False, 
                               transform=transforms) 

# define the data loaders
train_loader = DataLoader(dataset=train_dataset, 
                          batch_size=BATCH_SIZE, 
                          shuffle=True)  

valid_loader = DataLoader(dataset=valid_dataset, 
                          batch_size=BATCH_SIZE, 
                          shuffle=False) 

Here, I get the X and Y values of the train dataset and put them in numpy arrays:
X_train = []
Y_train = []
for x,y in train_loader:
    X_train.append(x.numpy())
    Y_train.append(y.numpy())
X_train = np.array(X_train, dtype=sp.posit8)
Y_train = np.array(Y_train, dtype=sp.posit8)

Finally, this is the part where the kernel dies:
aux = np.empty_like(X_train, dtype=sp.posit8)
for i in range(X_train.size):
    aux.flat[i] = sp.posit8(X_train.flat[i])

X_test = aux

Is there any solution to fix my kernel dead problem?
Thank you