tensorflow2.0

Why is the result of the code offered by Deep Learning with TensorFlow different from the snapshot in its book

跟風遠走 提交于 2021-02-19 07:49:05
问题 In the first chapter of Deep Learning with TensorFlow , it gives an example on how to build a simple neural network for recognizing handwritten digits. According to its description, the code bundle for the book can be found at GitHub. From the context, I think section Running a simple TensorFlow 2.0 net and establishing a baseline uses the code same with Deep-Learning-with-TensorFlow-2-and-Keras/mnist_V1.py. When I run this example code, it gives me the following output: The snapshot from the

Adapting Tensorflow RNN Seq2Seq model code for Tensorflow 2.0

£可爱£侵袭症+ 提交于 2021-02-19 03:00:15
问题 I am very new to Tensorflow and have been messing around with a simple chatbot-building project from this link. There were many warnings that were saying that things would be deprecated in Tensorflow 2.0 and that I should upgrade, so I did. I then used the automatic Tensorflow code upgrader to update all the necessary files to 2.0. There were a few errors with this. When processing the model.py file, it returned these warnings: 133:20: WARNING: tf.nn.sampled_softmax_loss requires manual check

How to do Cohen Kappa Quadratic Loss in Tensorflow 2.0?

痴心易碎 提交于 2021-02-18 08:16:14
问题 I'm trying to create the loss function according to: How can I specify a loss function to be quadratic weighted kappa in Keras? But in tensorflow 2.0: tf.contrib.metrics.cohen_kappa No longer exists. Is there an alternative? 回答1: def kappa_loss(y_pred, y_true, y_pow=2, eps=1e-10, N=4, bsize=256, name='kappa'): """A continuous differentiable approximation of discrete kappa loss. Args: y_pred: 2D tensor or array, [batch_size, num_classes] y_true: 2D tensor or array,[batch_size, num_classes] y

How to use Keras' predict_on_batch in tf.data.Dataset.map()?

只谈情不闲聊 提交于 2021-02-17 04:55:54
问题 I would like to find a way to use Keras' predict_on_batch inside tf.data.Dataset.map() in TF2.0. Let's say I have a numpy dataset n_data = 10**5 my_data = np.random.random((n_data,10,1)) my_targets = np.random.randint(0,2,(n_data,1)) data = ({'x_input':my_data}, {'target':my_targets}) and a tf.keras model x_input = Input((None,1), name = 'x_input') RNN = SimpleRNN(100, name = 'RNN')(x_input) dense = Dense(1, name = 'target')(RNN) my_model = Model(inputs = [x_input], outputs = [dense]) my

Could not find a Profile button in tensorboard after install profile-plugin

半城伤御伤魂 提交于 2021-02-16 09:33:37
问题 Tensorboard version: 2.3.0 before I install profile-plugin on Tensorboard: so I followed that order: pip install -U tensorboard-plugin-profile > Successfully installed tensorboard-plugin-profile-2.3.0 and the next time, still find a Profile button in tensorboard I tried to use this URL http://localhost:6006/#profile to open profile but it shows No dashboards are active for the current data set. 回答1: Problem Analysis Your problem sounds like you are using a virtual environment . Probably, you

Could not find a Profile button in tensorboard after install profile-plugin

戏子无情 提交于 2021-02-16 09:33:11
问题 Tensorboard version: 2.3.0 before I install profile-plugin on Tensorboard: so I followed that order: pip install -U tensorboard-plugin-profile > Successfully installed tensorboard-plugin-profile-2.3.0 and the next time, still find a Profile button in tensorboard I tried to use this URL http://localhost:6006/#profile to open profile but it shows No dashboards are active for the current data set. 回答1: Problem Analysis Your problem sounds like you are using a virtual environment . Probably, you

How to get tensorflow-gpu v2 working on Windows with NVidia GPU

落爺英雄遲暮 提交于 2021-02-15 07:39:45
问题 What are the steps to get tensorflow-gpu 2.x Python package working on Windows with an NVidia GPU? I.e. how can I get rid of Could not find 'cudart64_101.dll' and then Could not find 'cudnn64_7.dll' ? 回答1: Steps Requires specific versions according to the error messages you see, not latest versions! 1. Download and install latest NVidia driver https://www.nvidia.com/Download/index.aspx 2. Install Tensorflow Python package pip uninstall tensorflow pip install tensorflow-gpu 3. Test At first

Why Tensorflow results are different in Python versions 3.5 and 3.7

雨燕双飞 提交于 2021-02-11 15:58:58
问题 Why Tensorflow results are different in Python versions 3.5 (SQL server, machine learning services) and 3.7 (local machine, anaconda)? I found out, it depends on 4 parameters values: dataset size number of epochs number of 1st layer (input) neurons number of 2nd layer (hidden) neurons Here is the example: identical results: dataset size - 50 000 number of epochs - 5/3/2 number of 1st layer (input) neurons - 300 **number of 2nd layer (hidden) neurons - 80% from 1st layer** different results:

I can't install tensorflow 2.1.0 version

ぃ、小莉子 提交于 2021-02-11 14:00:50
问题 I have a problem that i can't install tensorflow 2.1.0 version using pip every time i try , i have this message: ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none) ERROR: No matching distribution found for tensorflow my machine specs: windows 10 , 64 bit , python 3.7 pip 20.1 回答1: Yep this is an issue with that version of python, try using python 3.6, it solved the issue for me 回答2: I got the problem resolved by upgrading the pip. pip3 install -

TensorFlow 2 How to use *args in tf.function?

笑着哭i 提交于 2021-02-11 13:40:56
问题 Update: Did a bit more testing and I can't reproduce the behaviour with: import tensorflow as tf import numpy as np @tf.function def tf_being_unpythonic(an_input, another_input): return an_input + another_input @tf.function def example(*inputs, other_args = True): return tf_being_unpythonic(*inputs) class TestClass(tf.keras.Model): def __init__(self, a, b): super().__init__() self.a= a self.b = b @tf.function def call(self, *inps, some_kwarg=False): if some_kwarg: return self.a(*inps) return