AttributeError: 'Tensor' object has no attribute '_keras_history'

I looked for all the "'Tensor' object has no attribute ***" but none seems related to Keras (except for...

How to make tensorflow median filter?

I'm trying to build GAN structure on my own at tensorflow homepage doesn't exist about median filter function and i hope to add median filter function after generated image more cleaner how can i...

Tf 2.0 : RuntimeError: GradientTape.gradient can only be called once on non-persistent tapes

In tf 2.0 DC Gan example in tensorflow 2.0 guide, there are two gradient tapes . See below. @tf.function def train_step(images): noise = tf.random.normal([BATCH_SIZE, noise_dim]) with...

Plotting subclassed model in tensorflow-2.0 beta

I have a subclassed model that instantiates a few custom layers via subclassing. I tried using keras.utils.plot_model() but all it does is print the model block, none of the layers appeared. Can...

"Unkown (custom) loss function" when using tflite_convert on a {TF 2.0.0-beta1 ; Keras} model

Summary My question is composed by: A context in which I present my project, my working environment and my workflow The detailed problem The concerned parts of my code The solutions I tried to...

'tuple' object has no attribute 'layer'

I am having many troubles trying to start training my model (a DCGAN). It is giving me the error: 'tuple' object has no attribute 'layer' I read that this could be due to having both the...

How to use tf.Lambda and tf.Variable at TensorFlow 2.0

I'm very new to TensorFlow 2.0. I wrote a code for Cyclic GAN as follows (I extract code only for building generator neural network): def instance_norm(x, epsilon=1e-5): scale =...

GAN failure to converge with both discriminator and generator loss go to 0

I'm training a GAN network by Keras in Tensorflow 2.0. I can get some reasonable yet not well-looked results, until I try to add BatchNormalization layers. I know the training of GAN is very...

Google Colab taking too long to train a GAN

I followed the Generative-Adversarial Network tutorial on the TensorFlow site (linked below), it says "This may take about one minute / epoch with the default settings on Colab.". So far only two...

Error when training model in Colab on TPU

I'm trying to build a GAN using TensorFlow and wanted to train it on TPU. However I'm getting the error mentioned below 'Make sure the slot variables are created under the same strategy scope....

Tensorflow JS GAN model never learns

I am trying to port the Python DCGAN MNIST Code Lab example (https://www.tensorflow.org/tutorials/generative/dcgan) to Tensorflow.js. The generator model should be able to create images of...

keras error when trying to get intermediate layer output: Could not create cudnn handle

I am building a model using keras. I am using: anaconda (python 3.7) tensorflow-gpu (2.1) keras (2.3.1) cuda (10.1.2) cudnn (7.6.5) nvidia driver (445.7) nvidia gpu: gtx 1660Ti (6GB) when I am...

How to downgrade to tensorflow-gpu version 1.12 in google colab

I am running a GAN which is compatible only with a older version of tensorflow GPU so I need to downgrade tensorflow gpu from 1.15 in google colab to 1.12. I tried using following commands which...

InvalidArgumentError: indices[1,0] = 4 is not in [0, 4)

I am trying to train my Conditional GAN model and I am getting this error: InvalidArgumentError: indices[1,0] = 4 is not in [0, 4) [[node model_4/embedding_3/embedding_lookup (defined at :3)...

Labeling of ISCX Botnet Dataset 2014 in Python

I am having trouble in using the malicious IP information for CIC Botnet Dataset given on their website. It has been mentioned as follows: Distribution of botnet types in the training...

tensorflow serving returning NaN when predict

I had trained one GAN model and saved the generator by the following function: tf.keras.models.save_model( generator, filepath=os.path.join(MODEL_PATH, 'model_saver'), ...

How to create a random tensor with a given shape with the C++ Tensorflow API?

I have a neural network (a GAN that saves a generated image from random noise), which uses during the inference a random tensor as an input. My model or GraphDef in .pb format shows the following...

Customize model.fit() in Tensorflow Keras - TypeError: TypeError: compile() got an unexpected keyword argument 'optimizer'

I am trying to implement my own weight training algorithm by modifying model.fit() in Keras. I have read this article from Keras which explains it quite well based on GANs. However, the issue that...

Keras Conv2DTranspose layers in Convolutional GAN

I'm trying to train a Convolutional GAN in Keras with Tensorflow backend for generating faces. Having read several examples there seem to be two ways to build the generator, you can either use the...

Cannot solve ValueError: Input 0 of layer sequential_1 is incompatible with the layer

I'm Having trouble solving this error: ValueError: Input 0 of layer sequential_1 is incompatible with the layer: expected axis -1 of input shape to have value 3 but received input with shape...

Tensorflow: How do I pass the gradient through an integer tensor?

I am having an issue maintaining the flow of gradients across a custom operation in my W-GAN network that I built with TensorFloww and Keras. I have structured the W-GAN to learn to produce an...

How to solve AssertionError: Could not compute output Tensor("conv2d_16/BiasAdd:0", shape=(None, 64, 64, 3), dtype=float32)?

I'm trying to implement GAN. I am getting AssertionError: Could not compute output Tensor("conv2d_16/BiasAdd:0", shape=(None, 64, 64, 3), dtype=float32). I don't know the reason. Help needed. Here...

Artifacts in StyleGAN generated images

I've written my own implementation of StyleGAN (paper here https://arxiv.org/abs/1812.04948), using PyTorch instead of Tensorflow, which is what the official implementation uses. I'm doing this...

Why do I get a BufferOverflowException when running a TensorFlowLite Model?

I want to run a custom tflite model on Android using TensorFlowLite (and using Kotlin). Despite using the TFLite support library to create a supposedly correctly shaped input and output buffer I...

Google Colab: You are connected to a GPU runtime, but not utilizing the GPU

There has been many questions on this topic before, but none of the answers fit my specific question. I am trying to train Mask RCNN using Keras 2.2.5 on Google Colab. I am getting a message...

Cannot compute ConcatV2 as input #1(zero-based) was expected to be a float tensor but is a double tensor [Op:ConcatV2] name: concat

Import Libraries %matplotlib inline import tensorflow as tf from tensorflow import keras import numpy as np import plot_utils import matplotlib.pyplot as plt from tqdm import...

How to use a trained TensorFlow model inside a custom loss function in Keras

Problem Statement I want to use a pretrained TensorFlow model inside a custom loss function to train another model, but get an error message. I am using TensorFlow 2.3 Keras with this code, where...

Feature Extraction with Resnet 152 tensorflow Keras transfer learning

I am trying to do feature extraction with TensorFlow. In short, I'm attempting to reproduce step 3 in ATTEND-GAN Model that linked to the given provided code base in prepro.py in Show Attend and...

Why GAN is unable to generate samples from some distributions?

I'm tried to implement basic GAN in Keras, based on this implementation. If I sample points on parabola GAN is converges and able to produce samples from this distribution, but if for example I...

Sudden Tensorflow / Keras Google Colab dependency problems `AttributeError: module 'tensorflow._api.v1.compat.v2' has no attribute '__internal__'`

I have running a machine learning model (Matterport's Mask R-CNN) in google colab for a couple of weeks. All of a sudden today I am unable to run any of my notebooks due to I think some kind of...