I have a class called RL_Brain: When I run the learn function, I get the following error: Answer the following line is causing that error Once you do that, there is no path from your loss function to your trainable variables so no gradient can be calculated.
Tag: tensorflow
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
Error when installing tensorflow on Ubuntu Server 20.04
I have a Raspberry Pi 4B with Ubuntu Server 20.04 and I’m getting an error when trying to install tensorflow. I have Python 3.8.5 64-bit installed My pip is also >19.0 Answer From the comment section for the benefit of the community. You need to look for aarch64/arm64 package in order to install Tensorflow on Ubuntu 20.4.
ValueError: Input 0 of layer conv2d_10 is incompatible with the layer: expected ndim=4, found ndim=3. Full shape received: [None, 100, 100]
So I have been following a tutorial about Machine learning and I have come to this point in the code: When I execute this code it gives me the following Error: ValueError: Input 0 of layer conv2d_10 is incompatible with the layer: expected ndim=4, found ndim=3. Full shape received: [None, 100, 100] I have seen multiple posts about this and
extracting images and their label one by one from ImageDataGenerator().flow_from_directory
so I imported my dataset(38 classes) for validation using ImageDataGenerator().flow_from_directory and i wanted to pick each image and its label one by one. For example i want to pick the first image and it’s label i tried this i get the image but for the label i just get an array of shape (32,38) with 0 and 1s Is there
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
Deploying Machine Learning Models Flask and REST API
Firstly, I am new to machine learning. I am trying to create a REST API which utilizes a Machine Learning Models with flask. The application When the user enters a speed value into a text box and …
Keras my_layer.output returning KerasTensor object instead of Tensor object (in custom loss function)
I’m trying to build a custom loss function in Keras v2.4.3: (as explained in this answer) But I think it’s behaving much different than expected (perhaps because of my Keras version?), I’m getting this error: And I think that’s because encoder.get_layer(‘mean’).output is returning a KerasTensor object instead of a tf.Tensor object (as the other answer indicates). What am I doing
TypeError: Expected binary or unicode string, got 618.0
I’ve been trying to implement this ML Linear Model into my dataset. (https://www.tensorflow.org/tutorials/estimator/linear) Language: Python 3.8.3 LÄ°braries: TensorFlow 2.4.0 Numpy: 1.19.3 Pandas Matplotliband the others: ss1517 is the name of my dataset. It is a CSV file with 4116 rows and 20 columns and has lots of NaN values( There is no column that hasn’t NaN value) CATEGORICAL_COLUMNS are the
ImportError: cannot import name ‘keras_tensor’ from ‘tensorflow.python.keras.engine’
I’m getting this error while loading the tensorflow addons library Answer This error is because you have incompatibility issues between your TensorFlow, Python and tensorflow-addons. Uninstall the tensorflow-addons and install the version based on the table below. Refer the Github repo for more information.