How to add two separate layers on the top of one layer using pytorch?

I want to add two separate layers on the top of one layer (or a pre-trained model) Is that possible for me to do using Pytorch?

Traing a CNN using Prelu activation function

I’m trying to train the model using prelu activation function, but I get the following error ————————————————————————— ValueError …

Pytorch crashes cuda on wrong line

How to see which python line causes a cuda crash down the line in Pytorch, which executes asynchronous code outside of the GIL? Here is a case where I had Pytorch crash cuda, running this code on this …

Pytorch: 1D target tensor expected, multi-target not supported

I want to train a 1D CNN on time series. I get the following error message 1D target tensor expected, multi-target not supported Here is the code with simulated data corresponding to the structures of …

Why do sometimes CNN models predict just one class out of all others?

I am relatively new to the deep learning landscape, so please don’t be as mean as Reddit! It seems like a general question so I won’t be giving my code here as it doesn’t seem necessary (if it is, …

Bounding box detection for characters / digits

I have images, which look like the following: I want to find the bounding boxes for the 8 digits. My first try was to use cv2 with the following code: import cv2 import matplotlib.pyplot as plt …

converting xavier to glorot in tensorflow code

I am trying to convert xavier initializer in a tensorflow code to glorot initializer. I am not sure which one of the following (or other options) is correct? #initializer = tf.contrib.layers….

Keras my_layer.output returning KerasTensor object instead of Tensor object (in custom loss function)

I’m trying to build a custom loss function in Keras v2.4.3: (as explained in this answer) def vae_loss(x: tf.Tensor, x_decoded_mean: tf.Tensor, original_dim=original_dim): z_mean = …

ValueError when using vae.fit in Keras

I am creating a vae model over the mnist dataset with hopes of plotting the loss function against the epochs. However I am experiencing some issues and was unable to find a solution online. During my …

Neural Network loss is significantly changing for same set of weights – Keras

model = keras.Sequential([ layers.Dense(10, activation = ‘relu’, weights=[zero_weights, zero_bias]), layers.Dense(24, activation = ‘relu’, weights=[one_weights, one_bias]), layers.Dense(12, …