Category : tensor

I have two arrays: inp_arr and indx_arr. The goal is to create sliding windows of the inp_arr from the indx_arr. In numpy, inp_arr[indx_arr] will create sliding windows of the inp_arr. Following is the MWE. import numpy as np inp_arr = np.random.rand(10, 3) # inp_arr array([[0.85257321, 0.07019212, 0.35636252], [0.32141462, 0.76053685, 0.88999183], [0.75308353, 0.79659116, 0.66134568], [0.32073745, 0.90427132, ..

Read more

I’m currently running Colab in an attempt to classify images using a CNN. I’m trying to find why this issue is being caused but I’m struggling to diagnose it & ultimate fix it. I’m splitting my datasets as follows: all_images,type1,type2=[],[],[] # Arrays to store data for file in files: image=cv2.imread(folder + file, 0) all_images.append(image) split_var=file.split(‘_’) ..

Read more

I encountered this error while training my neural network in pytorch. I am trying to pass images of size 48*48, in B&W which have only 3 features. As you can see here: torch.Size([3, 48, 48]) 0 I am not sure how relevant this is, but I have a 1000 different images for training, as well ..

Read more

I am computing the gradient on a minibatch of 256 elements in the following way: # input object input_tensor = tf.convert_to_tensor(np.array(256,w,h)) # target object target_tensor = tf.convert_to_tensor(np.array(256,w,h)) # watch the tensor to compute a gradient on it tape.watch(input_tensor) # perform feed forward pass output= model(input_tensor) # compute the loss with respect to the target representation ..

Read more