Issue I am trying to implement an image classifier using "The Street View House Numbers (SVHN) Dataset" from this link. I am using format 2 which contains 32×32 RGB centered digit images from 0 to 9. When I try to
Continue readingTag: tensorflow
[SOLVED] Keras – stateful vs stateless LSTMs
Issue I’m having a hard time conceptualizing the difference between stateful and stateless LSTMs in Keras. My understanding is that at the end of each batch, the “state of the network is reset” in the stateless case, whereas for the
Continue reading[SOLVED] AssertionError: Tried to export a function which references untracked resource
Issue I wrote a unit-test in order to safe a model after noticing that I am not able to do so (anymore) during training. @pytest.mark.usefixtures("maybe_run_functions_eagerly") def test_save_model(speech_model: Tuple[TransducerBase, SpeechFeaturesConfig]): model, speech_features_config = speech_model speech_features_config: SpeechFeaturesConfig channels = 3 if speech_features_config.add_delta_deltas
Continue reading[SOLVED] LSTM model: ValueError: Input 0 of layer "lstm" is incompatible with the layer: expected ndim=3, found ndim=2. Full shape received: (None, 7)
Issue I am building a keras model for a multi-class classification problem. my data set has 7 numerical features and 4 labels. I have structured the model as follows: def create_keras_model(): initializer = tf.keras.initializers.GlorotNormal() return tf.keras.models.Sequential([ #tf.keras.layers.Input(shape=(7,)), LSTM(units=20,kernel_initializer = initializer
Continue reading[SOLVED] How does tensorflow handle training data passed to a neural network?
Issue I am having an issue with my code that I modified from https://keras.io/examples/generative/wgan_gp/ . Instead of the data being images, my data is a (1001,2) array of sequential data. The first column being the time and the second the
Continue reading[SOLVED] RaggedTensor request to TensorFlow serving fails
Issue I’ve created a TensorFlow model that uses RaggedTensors. Model works fine and when calling model.predict and I get the expected results. input = tf.ragged.constant([[[-0.9984272718429565, -0.9422321319580078, -0.27657580375671387, -3.185823678970337, -0.6360141634941101, -1.6579184532165527, -1.9000954627990723, -0.49169546365737915, -0.6758883595466614, -0.6677696704864502, -0.532067060470581], [-0.9984272718429565, -0.9421600103378296, 2.2048349380493164, -1.273996114730835, -0.6360141634941101,
Continue reading[SOLVED] Matrix Powers in TensorFlow
Issue Given an integer k and a symmetric matrix A (as tf.Variable), how to compute the k-th power of A tf.matmul(A, tf.matmul(A, tf.matmul(A, …)… ) most efficiently in TensorFlow? Solution Using tf.while_loop should be quite efficient: import tensorflow as tf
Continue reading[SOLVED] How to use transfer learning from TensorHub with custom image sizes when using ImageDataGenerator and flow_from_directory
Issue I am trying to learn how to perform feature extraction from a pre-trained model for a transfer learning task. I am currently trying to use MobileNet v2 Feature extractor from tensorhub, Although the original image shapes are a tuple
Continue reading[SOLVED] Error when taking fft2d in TensorFlow on GPU
Issue The code below runs on CPU without any problems, But when I change to GPU in colab it fails to calculate the fft2d. import tensorflow as tf sample_fft_input = tf.random.uniform((2, 10, 20)) sfi = tf.cast(sample_fft_input , tf.complex64) sfi =
Continue reading[SOLVED] Train local model with SVM instead of NN in federated learning
Issue I have a dataset with numeric features and labels. I am building a federated learning model using TensorFlow (TFF). Basically, the model that I have is the (neural network) which is always explained in the TFF tutorials. I want
Continue reading