keras.load_model() can't recognize Tensorflow's activation functionsValueError: Output tensors to a Model must be the output of a TensorFlow Layer with tf.keras Lambda layerCan't import frozen graph after adding layers to Keras modelCan't save custom subclassed modelKeras custom activation function (not training)Error when loading Keras model trained by tensorflowError on trying to extract frozen tensorflow graphCannot Reload saved Keras model using tensorflowWhy tensorflow.contrib.framework.arg_scope not applicable to tf.keras.layers?Can't use tf.keras.optimizer with tf.keras.models.sequentialImport Keras directly or through TensorFlow? Should I uninstall either one?
Does Dispel Magic destroy Artificer Turrets?
How likely is fragmentation on a table with 40000 products likely to affect performance
Why did I lose on time with 3 pawns vs Knight. Shouldn't it be a draw?
How can Paypal know my card is being used in another account?
Irreducible factors of primitive permutation group representation
Do the books ever say oliphaunts aren’t elephants?
What did G-d do before Creation?
Why force the nose of 737 Max down in the first place?
Is there a wealth gap in Boston where the median net worth of white households is $247,500 while the median net worth for black families was $8?
Why is の所 used after ドア in this sentence?
What do I do with a party that is much stronger than their level?
Does dual boot harm a laptop battery or reduce its life?
Why did some Apollo missions carry a grenade launcher?
ECDSA: Why is SigningKey shorter than VerifyingKey
2 weeks and a tight budget to prepare for Z-day. How long can I hunker down?
If Trump gets impeached, how long would Pence be president?
To find islands of 1 and 0 in matrix
How do I use JSON.generator to generate an unnamed array?
Must a song using the A minor scale begin or end with an Am chord? If not, how can I tell what the scale is?
8086 stack segment and avoiding overflow in interrupts
Is there a way to know the composition of a Team GO Rocket before going into the fight?
What is more environmentally friendly? An A320 or a car?
Is it error of law to judge on less relevant case law when there is much more relevant one?
Name These Animals
keras.load_model() can't recognize Tensorflow's activation functions
ValueError: Output tensors to a Model must be the output of a TensorFlow Layer with tf.keras Lambda layerCan't import frozen graph after adding layers to Keras modelCan't save custom subclassed modelKeras custom activation function (not training)Error when loading Keras model trained by tensorflowError on trying to extract frozen tensorflow graphCannot Reload saved Keras model using tensorflowWhy tensorflow.contrib.framework.arg_scope not applicable to tf.keras.layers?Can't use tf.keras.optimizer with tf.keras.models.sequentialImport Keras directly or through TensorFlow? Should I uninstall either one?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I saved a tf.keras model using tf.keras.save_model
functions.
why tf.keras.load_model
throws an exception?
code example:
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
model = keras.Sequential([
layers.Dense(8, activation=tf.nn.leaky_relu),
layers.Dense(8, activation=tf.nn.leaky_relu)
])
tf.keras.models.save_model(
model,
'model'
)
tf.keras.models.load_model('model')
I expect this code to load the model, but it throws an exception:
ValueError: Unknown activation function:leaky_relu
thanks for your help !
tensorflow keras tf.keras
add a comment |
I saved a tf.keras model using tf.keras.save_model
functions.
why tf.keras.load_model
throws an exception?
code example:
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
model = keras.Sequential([
layers.Dense(8, activation=tf.nn.leaky_relu),
layers.Dense(8, activation=tf.nn.leaky_relu)
])
tf.keras.models.save_model(
model,
'model'
)
tf.keras.models.load_model('model')
I expect this code to load the model, but it throws an exception:
ValueError: Unknown activation function:leaky_relu
thanks for your help !
tensorflow keras tf.keras
This absolutely should work. Paste full code
– Sharky
Mar 26 at 19:39
@Sharky this is the full code. see colab example: colab.research.google.com/drive/…
– noam gaash
Mar 26 at 19:41
add a comment |
I saved a tf.keras model using tf.keras.save_model
functions.
why tf.keras.load_model
throws an exception?
code example:
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
model = keras.Sequential([
layers.Dense(8, activation=tf.nn.leaky_relu),
layers.Dense(8, activation=tf.nn.leaky_relu)
])
tf.keras.models.save_model(
model,
'model'
)
tf.keras.models.load_model('model')
I expect this code to load the model, but it throws an exception:
ValueError: Unknown activation function:leaky_relu
thanks for your help !
tensorflow keras tf.keras
I saved a tf.keras model using tf.keras.save_model
functions.
why tf.keras.load_model
throws an exception?
code example:
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
model = keras.Sequential([
layers.Dense(8, activation=tf.nn.leaky_relu),
layers.Dense(8, activation=tf.nn.leaky_relu)
])
tf.keras.models.save_model(
model,
'model'
)
tf.keras.models.load_model('model')
I expect this code to load the model, but it throws an exception:
ValueError: Unknown activation function:leaky_relu
thanks for your help !
tensorflow keras tf.keras
tensorflow keras tf.keras
asked Mar 26 at 19:31
noam gaashnoam gaash
9211 bronze badges
9211 bronze badges
This absolutely should work. Paste full code
– Sharky
Mar 26 at 19:39
@Sharky this is the full code. see colab example: colab.research.google.com/drive/…
– noam gaash
Mar 26 at 19:41
add a comment |
This absolutely should work. Paste full code
– Sharky
Mar 26 at 19:39
@Sharky this is the full code. see colab example: colab.research.google.com/drive/…
– noam gaash
Mar 26 at 19:41
This absolutely should work. Paste full code
– Sharky
Mar 26 at 19:39
This absolutely should work. Paste full code
– Sharky
Mar 26 at 19:39
@Sharky this is the full code. see colab example: colab.research.google.com/drive/…
– noam gaash
Mar 26 at 19:41
@Sharky this is the full code. see colab example: colab.research.google.com/drive/…
– noam gaash
Mar 26 at 19:41
add a comment |
1 Answer
1
active
oldest
votes
You need to add custom objects
tf.keras.models.load_model('model', custom_objects='leaky_relu': tf.nn.leaky_relu)
wow, that's working perfect! thank you !
– noam gaash
Mar 26 at 20:07
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55364954%2fkeras-load-model-cant-recognize-tensorflows-activation-functions%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You need to add custom objects
tf.keras.models.load_model('model', custom_objects='leaky_relu': tf.nn.leaky_relu)
wow, that's working perfect! thank you !
– noam gaash
Mar 26 at 20:07
add a comment |
You need to add custom objects
tf.keras.models.load_model('model', custom_objects='leaky_relu': tf.nn.leaky_relu)
wow, that's working perfect! thank you !
– noam gaash
Mar 26 at 20:07
add a comment |
You need to add custom objects
tf.keras.models.load_model('model', custom_objects='leaky_relu': tf.nn.leaky_relu)
You need to add custom objects
tf.keras.models.load_model('model', custom_objects='leaky_relu': tf.nn.leaky_relu)
answered Mar 26 at 20:00
SharkySharky
2,7142 gold badges9 silver badges19 bronze badges
2,7142 gold badges9 silver badges19 bronze badges
wow, that's working perfect! thank you !
– noam gaash
Mar 26 at 20:07
add a comment |
wow, that's working perfect! thank you !
– noam gaash
Mar 26 at 20:07
wow, that's working perfect! thank you !
– noam gaash
Mar 26 at 20:07
wow, that's working perfect! thank you !
– noam gaash
Mar 26 at 20:07
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55364954%2fkeras-load-model-cant-recognize-tensorflows-activation-functions%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This absolutely should work. Paste full code
– Sharky
Mar 26 at 19:39
@Sharky this is the full code. see colab example: colab.research.google.com/drive/…
– noam gaash
Mar 26 at 19:41