I created an ImageDataGenerator that works fine, lets call it img_gen, it produces batches of images and their corresponding GT. Now when I use model.fit(img_gen) it runs for ~300 iterations per epoch but when I iterate over it using a for loop it never stops. for x,y in img_gen: iterate endlessly while using fit it ..

#### Category : tf.keras

import numpy as np import tensorflow as tf class ProbDistWRTChoices(tf.keras.layers.Layer): def __init__(self, maxChoice): super().__init__() self.maxChoice = maxChoice def call(self, inputs): utility, rowlengths = inputs utility = tf.reshape(utility, -1) utility = tf.RaggedTensor.from_row_lengths(values = utility, row_lengths = rowlengths) utility = utility.to_tensor(default_value = -1e9, shape = (None, self.maxChoice)) prob = tf.nn.softmax(utility, axis=-1) return prob class MNLogit(tf.keras.Model): def __init__(self, ..

I Have a list of matrix with shape(2,30000), I need to pass this info as an input of a deep learning model with tensorflow using a conv layer, but when I tried to pass this for training all the time I obtain return ops.EagerTensor(value, ctx.device_name, dtype) ValueError: Failed to convert a NumPy array to a ..

I have created a NN with multiple input and a single output. My simple Net has 3 input nodes for each observation and in the hidden layer(middle) just one node. After that I have concatenated them. Finally there is a single output with as many nodes as input nodes. num_vars_per_input = 3 num_single_inputs = 2 ..

I’m running an LSTM network that works fine (TF 2.0). My problem starts when trying to modify the loss function. I planed to adjust some data manipulation over ‘y_true’ and ‘y_pred’ but since TF force to maintain the data as tensors (and not convert it to Pandas or NumPy) it is challenging. To get better ..

In Keras or Tensorflow clipnorm rescales large "gradients" to have a specific norm and clipvalue bounds all the values of the "gradient". But what happens if you combine one of them with moemntum or something like adam. A) Is clipnorm applied on the actual pure mathematical gradient of the loss with respect to the parameters ..

I’m familiar with the confusion_matrix function from sklearn. But I have a large data-set where I train a model with. I created a data generator using keras functionality, flow_from_dataframe, it works fine and the model learns properly and also predicts. But I wish to do a confusion matrix of the performance but instead of having ..

I’m trying to create a NN, which has as input a matrix of players (n) with some specific features (m). This is a n * m matrix. My idea is to select a subset of these players using a neural network. However my idea is to give as input, in the input node, each single ..

Tensorflow 2.0 python 3.7 I trained and saved a model like this using tf.keras import tensorflow as tf from tensorflow import keras from tensorflow.keras import datasets, layers, models from tensorflow.keras.datasets import mnist (train_images, train_labels), (test_images, test_labels) = datasets.cifar10.load_data() # Normalize pixel values to be between 0 and 1 train_images, test_images = train_images / 255.0, test_images ..

I try to use a single optimizer to update both model’s parameters at the same time, however, I am having trouble setting this up. The overall idea is: (Assume model 1 and model 2 are sequential models) ”’ output1=model1(input1) imm1=normalized(output1)#over here, i normalized the output1 with numpy output2=model2(imm1) output3=concat(output2,ouput1) #numpy function loss1=l1norm(imm1-output3) #numpy function loss2=l2norm(imm1+output2,output3) ..

## Recent Comments