tensorflow

TensorFlow - reproducing results when using dropout

纵然是瞬间 提交于 2021-02-07 20:58:51
问题 I am training a neural network using dropout regularization. I save the weights and biases the network is initialized with, so that I can repeat the experiment when I get good results. However, the use of dropout introduces some randomness in the network: since dropout drops units randomly, each time I rerun the network, different units are being dropped - even though I initialize the network with the exact same weights and biases (if I understand this correctly). Is there a way to make the

TensorFlow - reproducing results when using dropout

。_饼干妹妹 提交于 2021-02-07 20:57:55
问题 I am training a neural network using dropout regularization. I save the weights and biases the network is initialized with, so that I can repeat the experiment when I get good results. However, the use of dropout introduces some randomness in the network: since dropout drops units randomly, each time I rerun the network, different units are being dropped - even though I initialize the network with the exact same weights and biases (if I understand this correctly). Is there a way to make the

How to get the value of a tensor? Python

白昼怎懂夜的黑 提交于 2021-02-07 20:30:28
问题 While doing some calculations I end up calculating an average_acc . When I try to print it, it outputs: tf.Tensor(0.982349, shape=(), dtype=float32) . How do I get the 0.98.. value of it and use it as a normal float? What I'm trying to do is get a bunch of those in an array and plot some graphs, but for that, I need simple floats as far as I can tell. 回答1: It looks to me as if you have not evaluated the tensor. You can call tensor.eval() to evaluate the result, or use session.run(tensor) .

Compare Two Tensorflow Graphs

假如想象 提交于 2021-02-07 20:26:05
问题 What is the easiest way to compare two GCMLE deployed prediction models and identify any differences in their graphs? I have visually inspected both tensorboards and they look identical (as they should be). However, I have code to visualize their activations (basically just loads the weights from the graphs and manually performs all forward steps) and somewhere along the way on one of the graphs my hand-written forward pass calculations diverge from tensorflow's forward pass calculations. The

Understanding tensorflow inter/intra parallelism threads

十年热恋 提交于 2021-02-07 19:48:14
问题 I would like to understand a little more about these two parameters: intra and inter op parallelism threads session_conf = tf.ConfigProto( intra_op_parallelism_threads=1, inter_op_parallelism_threads=1) I read this post which has a pretty good explanation: TensorFlow: inter- and intra-op parallelism configuration But I am seeking confirmations and also asking new questions below. And I am running my task in keras 2.0.9, tensorflow 1.3.0: when both are set to 1, does it mean that, on a

Understanding tensorflow inter/intra parallelism threads

你离开我真会死。 提交于 2021-02-07 19:47:16
问题 I would like to understand a little more about these two parameters: intra and inter op parallelism threads session_conf = tf.ConfigProto( intra_op_parallelism_threads=1, inter_op_parallelism_threads=1) I read this post which has a pretty good explanation: TensorFlow: inter- and intra-op parallelism configuration But I am seeking confirmations and also asking new questions below. And I am running my task in keras 2.0.9, tensorflow 1.3.0: when both are set to 1, does it mean that, on a

Google Cloud ML: Outer dimension for outputs must be unknown

为君一笑 提交于 2021-02-07 19:41:08
问题 we got a working exported model in local that is falling to create a new model version in Google Cloud ML as follows: Create Version failed. Model validation failed: Outer dimension for outputs must be unknown, outer dimension of 'Const_2:0' is 1 For more information on how to export Tensorflow SavedModel, seehttps://www.tensorflow.org/api_docs/python/tf/saved_model. Our current exported model response is working in tensorflow-serve and gcloud predict local with this responses: outputs { key:

ImportError: cannot import name 'keras'

允我心安 提交于 2021-02-07 18:47:25
问题 When running this in Jupyter notebooks (python): import tensorflow as tf from tensorflow import keras I get this error: ImportError: cannot import name 'keras' I've tried other commands in place of the second one, such as (but not limited to) from tensorflow.keras import layers But it always returns some error. I'm using the online version of Jupyter, and running print(tf.VERSION) returns 1.1.0. I'm not sure if the problem is just that I have the wrong version, or if it's something else. How

How to convert Tensorflow 2.0 SavedModel to TensorRT?

心已入冬 提交于 2021-02-07 17:30:23
问题 I've trained a model in Tensorflow 2.0 and am trying to improve predict time when moving to production (on a server with GPU support). In Tensorflow 1.x I was able to get a predict speedup by using freeze graph, but this has been deprecated as of Tensorflow 2. From reading Nvidia's description of TensorRT, they suggest that using TensorRT can speedup inference by 7x compared to Tensorflow alone. Source: TensorFlow 2.0 with Tighter TensorRT Integration Now Available I have trained my model and

How to convert Tensorflow 2.0 SavedModel to TensorRT?

一个人想着一个人 提交于 2021-02-07 17:29:43
问题 I've trained a model in Tensorflow 2.0 and am trying to improve predict time when moving to production (on a server with GPU support). In Tensorflow 1.x I was able to get a predict speedup by using freeze graph, but this has been deprecated as of Tensorflow 2. From reading Nvidia's description of TensorRT, they suggest that using TensorRT can speedup inference by 7x compared to Tensorflow alone. Source: TensorFlow 2.0 with Tighter TensorRT Integration Now Available I have trained my model and