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;








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 !










share|improve this question
























  • 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


















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 !










share|improve this question
























  • 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














0












0








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 !










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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


















  • 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













1 Answer
1






active

oldest

votes


















2














You need to add custom objects



tf.keras.models.load_model('model', custom_objects='leaky_relu': tf.nn.leaky_relu)





share|improve this answer

























  • wow, that's working perfect! thank you !

    – noam gaash
    Mar 26 at 20:07










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
);



);













draft saved

draft discarded


















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









2














You need to add custom objects



tf.keras.models.load_model('model', custom_objects='leaky_relu': tf.nn.leaky_relu)





share|improve this answer

























  • wow, that's working perfect! thank you !

    – noam gaash
    Mar 26 at 20:07















2














You need to add custom objects



tf.keras.models.load_model('model', custom_objects='leaky_relu': tf.nn.leaky_relu)





share|improve this answer

























  • wow, that's working perfect! thank you !

    – noam gaash
    Mar 26 at 20:07













2












2








2







You need to add custom objects



tf.keras.models.load_model('model', custom_objects='leaky_relu': tf.nn.leaky_relu)





share|improve this answer













You need to add custom objects



tf.keras.models.load_model('model', custom_objects='leaky_relu': tf.nn.leaky_relu)






share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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






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.



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현