Merge duplicate indices in a sparse tensor

Lets say I have a sparse tensor with duplicate indices and where they are duplicate I want to merge values (sum them up) What is the best way to do this? example: indicies = [[1, 1], [1, 2], [1,...

Tensorflow doesn't seem to see my gpu

I've tried tensorflow on both cuda 7.5 and 8.0, w/o cudnn (my GPU is old, cudnn doesn't support it). When I execute device_lib.list_local_devices(), there is no gpu in the output. Theano sees my...

Tensorflow batch loss spikes when restoring model for training from saved checkpoint?

I'm encountering a strange issue that I've been trying to debug, without much luck. My model starts training properly with batch loss decreasing consistently (from ~6000 initially to ~120 after 20...

How to use hyperopt for hyperparameter optimization of Keras deep learning network?

I want to build a non linear regression model using keras to predict a +ve continuous variable. For the below model how do I select the following hyperparameters? Number of Hidden layers and...

ValueError: The passed save_path is not a valid checkpoint: modeltest.ckpt

I run this code tf.reset_default_graph() v1 = tf.Variable(tf.constant(0.1, shape = [2]), name="v1") v2 = tf.Variable(tf.constant(0.2, shape = [2]), name="v2") saver = tf.train.Saver() with...

Conv 1x1 configuration for feature reduction

I am using 1x1 convolution in the deep network to reduce a feature x: Bx2CxHxW to BxCxHxW. I have three options: x -> Conv (1x1) -> Batchnorm-->ReLU. Code will be output = ReLU(BN(Conv(x)))....

How to graph tf.keras model in Tensorflow-2.0?

I upgraded to Tensorflow 2.0 and there is no tf.summary.FileWriter("tf_graphs", sess.graph). I was looking through some other StackOverflow questions on this and they said to use...

Loading Tensorflow model in c#

I am really struggling with the fact that i don't know how can I load and use a TensorFlow image classifier model in c#. To be more precise I want to use a model trained in Teachable Machine that...

tensorflow (not tensorflow-gpu): failed call to cuInit: UNKNOWN ERROR (303)

My Test import tensorflow as tf hello = tf.constant('Hello, TensorFlow!') sess = tf.Session() My Error 2019-12-27 10:51:17.887009: W tensorflow/stream_executor/platform/default/dso_loader.cc:55]...

Using tensorflow.keras model in pyspark UDF generates a pickle error

I would like to use a tensorflow.keras model in a pysark pandas_udf. However, I get a pickle error when the model is being serialized before sending it to the workers. I am not sure I am using the...

How to incorporate many features into a TensorFlow Probability Structural Time Series

I'm wondering how to train a Multivariate Bayesian Structural Time Series (BSTS) model that automatically performs feature selection on hundreds of input time series using Tensorflow...

Are we able to prune a pre-trained model? Example: MobileNetV2

I'm trying to prune a pre-trained model: MobileNetV2 and I got this error. Tried searching online and couldn't understand. I'm running on Google Colab. These are my imports. import tensorflow as...

Tensorflow-gpu not detecting GPU?

I have tensorflow-gpu version 2.2.0 installed with Anaconda in python 3.7.4, but my code always runs on CPU and It's not able to detect my GPU. physical_devices=...

tensorflow error: "No OpKernel was registered to support Op 'TPUReplicatedInput'" when restoring model

(Novice question; sorry in advance.) I have a pretrained (BigGAN) tensorflow model that another user developed to create images, and I would like to use it to generate new images. (If it helps to...

Saving normalization values in Keras model

I have a Keras model for which I would like to save the normalization values in the model object itself for easier portability. I'm using sklearn's StandardScaler() to normalize my data, so I...

Tensorflow for XOR is not predicting correctly after 500 epochs

I'm trying to implement a Neural Network to solve the XOR problem using TensorFlow. I chose sigmoid as activation function, shape (2, 2, 1) and optimizer=SGD(). I choose batch_size=1 because the...

What does this tensorflow message mean? Any side effect? Was the installation successful?

I just installed tensorflow v2.3 on anaconda python. I tried to test out the installation using the python command below; $ python -c "import tensorflow as tf; x = [[2.]]; print('tensorflow...

TypeError: Could not build a TypeSpec with type KerasTensor

I am a newbie to deep learning so while I am trying to build a Masked R-CNN model for training my Custom Dataset I am getting an error which reads: TypeError: Could not build a TypeSpec for...

How to apply chain rule to multiple tf.GradientTape?

I'm studying pipeline model parallelism with TensorFlow 2 and MPI. But I can't figure out how to apply the chain rule when using multiple tf.GradientTape across multiple processes. Here is the...

Gradient Accumulation with Custom model.fit in TF.Keras?

Please add a minimum comment on your thoughts so that I can improve my query. Thank you. -) I'm trying to train a tf.keras model with Gradient Accumulation (GA). But I don't want to use it in the...

How to get specific landmark of face like lips or eyes using tensorflow.js face-landmark-detection model

I am trying to change the shape and position of eyes and lips and for this purpose I use tenserflow.js face-landmark-detection model. I get the all 468 facial landmarks but the problem is i don't...

Usage of FactorizedTopK in TensorFlow Recommenders

I looked at all the quickstart tutorials and used the basic_retrieval example to adjust it to my dataset. views_df contains pairs of user_ids and content_ids and represent when a user viewed a...

How to correctly save and load a model with custom CTC layer (Keras example)

I am following this tutorial on Keras , but I don't know how to correctly save this model with custom layer after the training and load it. This problem has been mentioned in here and here but...

How to clear Colab Tensorflow TPU memory

I am executing model for several folds. After each fold I want to clear the TPU memory so that I don't get OOM error. Full trace of the current error. ResourceExhaustedError ...

How to create a dynamic number of layers in Tensorflow?

In Keras, I would do the following to dynamically create a model's layers: for i in range(number_dense_layers): model.add(layers.Dense(units=units, input_dim=input_dim, ...

ModuleNotFoundError: No module named 'tfx.utils.dsl_utils'

I did install tfx version 1.2.1 Python: 3.8.2 Tensorflow: 2.5.2 pip: 21.3.1 I use window and installed the package through pip. The error occurred when I did: import os from tfx.components import...

InternalError: Failed copying input tensor from device:CPU:0 to device:GPU:0 in order to run _EagerConst: Dst tensor is not initialized

[email protected]_machine:~/spatial/tuning_neighbors_7$ python3 *hyper*.py Traceback (most recent call last): File "tuner_hyperband.py", line 209, in <module> load_data_k( File...

cannot import name '_registerMatType' from 'cv2.cv2'

I got below error message when I run model_main_tf2.py on Object Detection API. " Traceback (most recent call last): File "/content/models/research/object_detection/model_main_tf2.py", line 32,...

Tensorflow setup in R | Error: Failed to load the native TensorFlow runtime

For the last 5 days, I am trying to make Keras/Tensorflow packages work in R. I am using RStudio for installation and have used conda, miniconda, virtualenv but it crashes each time in the end....

Inference using saved model in Tensorflow 2: how to control in/output?

Adapting my code from TF1 to TF2.6 I run into trouble. I am trying to add some custom layers to an inception resnet, save the model, and then load and run it. from tensorflow.keras.layers import...