Questions tagged [tf.keras]

[tf.keras] is TensorFlow's implementation of the Keras API specification. Use the tag for questions specific to this TensorFlow module. You might also add the tag [keras] to your question since it has the same API.

is TensorFlow's implementation of the Keras API specification. Use the tag for questions specific to this TensorFlow module. You might also add the -tag to your question since it has the same API.

gives you the power and flexibility of Keras within TensorFlow (see the docs for examples). The API of is described here.

References:

2208 questions
0
votes
1 answer

tf.function causes out of scope error when inputs passed to add_loss

Can loss terms be manually added with add_loss inside a tensorflow graph? The below example for using add_loss is largely copied from https://www.tensorflow.org/guide/keras/custom_layers_and_models#the_add_loss_method but with @tf.function added to…
LexTron
  • 35
  • 1
  • 5
0
votes
1 answer

Making a Convolutional Neural Network from a flow diagram

I am trying to make a neural network from a flow diagram. It is necessary for my analysis to translate this network into a code. Could you help me if I'm doing anything wrong. Here is the diagram. The author used binary classification but I'm doing…
0
votes
1 answer

Why do Keras layers behave differently when copy/pasted into my script?

When I copy-and-paste TF's PReLU layer to my own script, it appears to build differently than the packaged version. Below I show a toy model with the PReLU code from my installation (2.9.2 on mac m1) fail to report any trainable parameters. In the…
Mack
  • 11
  • 3
0
votes
1 answer

How to do tf.reshape with shape dynamiclly?

i am working on tensorflow 2.x. I want to accept an Integer as one of the Multi-Inputs, and in some stage of the model, i need to do tf.reshape with shape set by the Integer of Input. It is more like: ... x_h = Input((shape=(),…
walter
  • 11
  • 2
0
votes
0 answers

Ways to decrease validation loss % and increase validation accuracy %?

I'm trying to work with a image classification model for gravity waves detection. So I want to check if there is something I could do to lower validation loss %, or more importantly, increase validation accuracy %. The dataset is about a total of…
0
votes
0 answers

Update keras model weights from external loss

I am trying to train a model based on an external cost function, the scheme is as follows: first the model_1 receives spectrograms and based on them produces an output vector of 4 values. Model_2 (which is already trained and I do not want their…
CYD
  • 33
  • 4
0
votes
1 answer

Keras "SavedModel file does not exist at..." for a model retrieved from an online URL

Keras "SavedModel file does not exist at..." error occurs for a model retrieved from an online URL and never manually saved at any local directory. The code ran just fine for as long as I've been working on it before but I reopened the project today…
0
votes
1 answer

Is validation curve slight greater or lower in CNN models good?

Can you tell me which one among the two is a good validation vs train plot? Both of them are trained with same keras sequential layers, but the second one is trained using more number of samples, i.e. augmented the dataset. I'm a little bit…
0
votes
1 answer

Not Implemented Error: Exception encountered building CNN-LSTM model in Tensorflow 2.9

This is a code snippet for building a cnn-lstm with pre-trained mobilenet encoder head. inputs = Input(shape = (60, 224, 224, 3)) cnn_base = MobileNetV3Small(include_top = False, weights='imagenet', input_shape = (224, 224, 3)) cnn_out =…
0
votes
1 answer

Autoencoding, using encoding and decoding layers in Keras, Tensorflow- issues in defining latent layers

I've been following a convolutional autoencoder, derived from https://medium.com/analytics-vidhya/building-a-convolutional-autoencoder-using-keras-using-conv2dtranspose-ca403c8d144e using a data set of 72x72 greyscale images. I've been able to…
alpined
  • 3
  • 2
0
votes
1 answer

Could not find matching function to call loaded model

I trained a deep neural network using a custom object and was able to successfully train it however when I saved and try to reload the model for retraining, I got the subject of the post as an error. I've tried using TensorFlow to create a…
Segun
  • 1
0
votes
0 answers

Combine keras model horizontally, one of them pretrained

I have two functional Keras models in the same level (same input and output shape), one of them is pre-trained, I would like to combine them horizontally and then retrain the whole model. I mean I want to initialize the pretrained with its weights…
deijany91
  • 9
  • 4
0
votes
1 answer

Keras/TensorFlow: What is the order of the weight tensor dimensions of a convolutional layer?

In channels_last format, the shape of the data tensor is (batch_size, height, width, channels) and the shape of the weight tensor is apparently (see reference 2) (rows, cols, input_depth, output_depth). In channels_first format, the shape of the…
0
votes
1 answer

ValueError: Dimensions must be equal in Tensorflow/Keras

My codes are as follow: v = tf.Variable(initial_value=v, trainable=True) v.shape is (1, 768) In the model: inputs_sents = keras.Input(shape=(50,3)) inputs_events = keras.Input(shape=(50,768)) x_1 = tf.matmul(v,tf.transpose(inputs_events)) x_2 =…
R__
  • 87
  • 5
0
votes
0 answers

Use Keras to make prediction model throws error

Im trying to use Keras model to recommend visits to some content based on his previous visits and other users behaviours. I have done something similar with a book recommendator system with a rating of 1-5. user_id content_id visit 1 1 …
psyvic
  • 29
  • 4