Skip to content
Advertisement

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

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

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

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

Advertisement