tensorflow

Keras Sequential without providing input shape

你说的曾经没有我的故事 提交于 2020-12-30 07:00:06
问题 I currently have a keras model that looks like this: model = keras.Sequential() model.add(keras.layers.Dense(100, activation=tf.nn.relu)) model.add(keras.layers.Dense(100, activation=tf.nn.relu)) model.add(keras.layers.Dense(len(labels), activation=tf.nn.softmax)) The Keras documentation tells me: The model needs to know what input shape it should expect. For this reason, the first layer in a Sequential model (and only the first, because following layers can do automatic shape inference)

How to fix “RuntimeError: Missing implementation that supports: loader” when calling hub.text_embedding_column method?

回眸只為那壹抹淺笑 提交于 2020-12-30 06:39:50
问题 I'm trying to fit a text classification model. Therefore i wanted to use the text_embedding_column function provided by tensorflow-hub. Unfortunately i get a runtime error import tensorflow_hub as hub embedded_text_feature_column = hub.text_embedding_column( key="sentence", module_spec="https://tfhub.dev/google/nnlm-en-dim128/1") The error i get is the following: RuntimeError Traceback (most recent call last) <ipython-input-18-df9239a27166> in <module>() 2 embedded_text_feature_column = hub

How to fix “RuntimeError: Missing implementation that supports: loader” when calling hub.text_embedding_column method?

心不动则不痛 提交于 2020-12-30 06:37:14
问题 I'm trying to fit a text classification model. Therefore i wanted to use the text_embedding_column function provided by tensorflow-hub. Unfortunately i get a runtime error import tensorflow_hub as hub embedded_text_feature_column = hub.text_embedding_column( key="sentence", module_spec="https://tfhub.dev/google/nnlm-en-dim128/1") The error i get is the following: RuntimeError Traceback (most recent call last) <ipython-input-18-df9239a27166> in <module>() 2 embedded_text_feature_column = hub

How to fix “RuntimeError: Missing implementation that supports: loader” when calling hub.text_embedding_column method?

不羁的心 提交于 2020-12-30 06:37:12
问题 I'm trying to fit a text classification model. Therefore i wanted to use the text_embedding_column function provided by tensorflow-hub. Unfortunately i get a runtime error import tensorflow_hub as hub embedded_text_feature_column = hub.text_embedding_column( key="sentence", module_spec="https://tfhub.dev/google/nnlm-en-dim128/1") The error i get is the following: RuntimeError Traceback (most recent call last) <ipython-input-18-df9239a27166> in <module>() 2 embedded_text_feature_column = hub

Tensorflow complains that no CUDA-capable device is detected

|▌冷眼眸甩不掉的悲伤 提交于 2020-12-30 03:55:08
问题 I'm trying to run some Tensorflow code, and I get what seems to be a common problem: $ LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64 python -c "import tensorflow; tensorflow.Session()" 2019-02-06 20:36:15.903204: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 2019-02-06 20:36:15.908809: E tensorflow/stream_executor/cuda/cuda_driver.cc:300] failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable

No module named 'tensorflow_probability'

不打扰是莪最后的温柔 提交于 2020-12-30 02:27:46
问题 I need to use Tensorflow and Tensorflow_Probability. After installing it by these commands: conda install tensorflow-probability or pip install --upgrade tensorflow-probability , I ran it in the notebook: import tensorflow_probability as tfp but it returns this error: ModuleNotFoundError Traceback (most recent call last) <ipython-input-8-41494c8c96ff> in <module> ----> 1 import tensorflow_probability as tfp ModuleNotFoundError: No module named 'tensorflow_probability'. The results of pip list

What is the difference in purpose between tf.py_function and tf.function?

主宰稳场 提交于 2020-12-30 01:43:46
问题 The difference between the two is muddled in my head, notwithstanding the nuances of what is eager and what isn't. From what I gather, the @tf.function decorator has two benefits in that it converts functions into TensorFlow graphs for performance, and allows for a more Pythonic style of coding by interpreting many (but not all) common-place Python operations into tensor operations, e.g. if into tf.cond , etc. From the definition of tf.py_function , it seems that it does just #2 above. Hence,

What is the difference in purpose between tf.py_function and tf.function?

|▌冷眼眸甩不掉的悲伤 提交于 2020-12-30 01:37:57
问题 The difference between the two is muddled in my head, notwithstanding the nuances of what is eager and what isn't. From what I gather, the @tf.function decorator has two benefits in that it converts functions into TensorFlow graphs for performance, and allows for a more Pythonic style of coding by interpreting many (but not all) common-place Python operations into tensor operations, e.g. if into tf.cond , etc. From the definition of tf.py_function , it seems that it does just #2 above. Hence,

Model inputs must come from `tf.keras.Input` …, they cannot be the output of a previous non-Input layer

∥☆過路亽.° 提交于 2020-12-29 18:21:01
问题 I'm using Python 3.7.7. and Tensorflow 2.1.0. I have a pre-trained U-Net network, and I want to get its encoder and its decoder . In the following picture: You can see a convolutional encoder-decoder architecture. I want to get the encoder part, that is, the layers that appears on the left of the image: And the decoder part: I get the U-Net model from this function: def get_unet_uncompiled(img_shape = (200,200,1)): inputs = Input(shape=img_shape) conv1 = Conv2D(64, (5, 5), activation='relu',

Model inputs must come from `tf.keras.Input` …, they cannot be the output of a previous non-Input layer

ⅰ亾dé卋堺 提交于 2020-12-29 18:10:57
问题 I'm using Python 3.7.7. and Tensorflow 2.1.0. I have a pre-trained U-Net network, and I want to get its encoder and its decoder . In the following picture: You can see a convolutional encoder-decoder architecture. I want to get the encoder part, that is, the layers that appears on the left of the image: And the decoder part: I get the U-Net model from this function: def get_unet_uncompiled(img_shape = (200,200,1)): inputs = Input(shape=img_shape) conv1 = Conv2D(64, (5, 5), activation='relu',