Skip to content
Advertisement

Tag: tensorflow2.0

tensorflow: InvalidArgumentError while find the AUC score

I have a dataset with labels 0’s and 1’s, which is binary classification problem. Getting error while try to find AUC score using tf.keras.metrics.AUC() as metrics in model.compile(.. function. Code: If I removed AUC from metrics, the code runs fine. Error: InvalidArgumentError: assertion failed: [predictions must be >= 0] [Condition x >= y did not hold element-wise:] [x (sequential_48/dense_293/BiasAdd:0) =

shape of an output tensor after convolutional filter on a colour image

I find it difficult to understand a notion about tensors. For VGG (https://www.tensorflow.org/api_docs/python/tf/keras/applications/VGG16), we start from a batch of colour images (none,224,224,3) and apply 64 2D convolutional filters. At the output we obtain a tensor of (none,224,224,64), we can see this by making a summary of the model. However, a filter must treat all 3 colours and my intuition tells

Exponential of SparseTensor with mapping

I want to take the exp of each element in the sparse matrix. Here is a simple example: But this gives the followig error: Can you please help me to sort this out without converting this to dense matrix? Answer If you have Tensorflow 2.4, you can use tf.sparse.map_values: Here is the magic: Note that tf.sparse.to_dense is only there so

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? Answer Based on the code for xavier_initializer, the default is uniform=True which suggests glorot_uniform may be what you want. If you are using tf2, you may use tf.keras.initializers.GlorotUniform(). tf.keras.initializers.glorot_uniform is just a

Why is the result of the code offered by Deep Learning with TensorFlow different from the snapshot in its book

In the first chapter of Deep Learning with TensorFlow, it gives an example on how to build a simple neural network for recognizing handwritten digits. According to its description, the code bundle for the book can be found at GitHub. From the context, I think section Running a simple TensorFlow 2.0 net and establishing a baseline uses the code same

Implementing Multiclass Dice Loss Function

I am doing multi class segmentation using UNet. My input to the model is HxWxC and my output is, Using SparseCategoricalCrossentropy I can train the network fine. Now I would like to also try dice coefficient as the loss function. Implemented as follows, However, I am actually getting an increasing loss instead of decreasing loss. I have checked multiple sources

Tensorflow 2.3, Tensorflow dataset, TypeError: () takes 1 positional argument but 4 were given

I use tf.data.TextLineDataset to read 4 large files and I use tf.data.Dataset.zip to zip these 4 files and create “dataset”. However, I can not pass “dataset” to dataset.map to use tf.compat.v1.string_split and split with t separator and finally use batch, prefetch and finally feed into my model. This is my code: This is error message: What should I do? Answer

Advertisement