IndexError: index 4 is out of bounds for dimension 0 with size 4?

I am tying to write a NN in pytorch that learns to give for example: very simple A+B for two images. Writing it, I got this error. my batch_size is 4. class myNet(nn.Module): def __init__(self): super(myNet, self).__init__() self.fc1 = nn.Linear(3072, 3072) # set up FC layer self.fc2 = nn.Linear(3072, 3072) # set up the other… Read More IndexError: index 4 is out of bounds for dimension 0 with size 4?

problem when loading a keras model saved through a wrapper class

I have the following wrapper class: from tensorflow.keras.models import Sequential class NeuralNet(Sequential): def __init__(self, **kwargs): super().__init__(**kwargs) I can fit and save the model without problems, but when I try to load it: from tensorflow.keras.models import load_model model = load_model(‘model.h5’) I get: –> 296 raise ValueError(‘Unknown ‘ + printable_module_name + ‘: ‘ + class_name) 297 298… Read More problem when loading a keras model saved through a wrapper class

np.random.rand somehow produces floats bigger than 1 [solved, it doesn't]

I’m trying to create a 2-layer neural network, for that I first initialize weights and biases to random floats between 0 an 1 using numpy.random.rand. However, for some reason this process produces floats bigger than 1 for W1 (weight 1) whereas it works correctly for all other weights an biases. I can’t understand why this… Read More np.random.rand somehow produces floats bigger than 1 [solved, it doesn't]