tfp.layers.util.serialize_function
Stay organized with collections
Save and categorize content based on your preferences.
Serializes function for Keras.
tfp.layers.util.serialize_function(
func
)
(De)serializing Python functions from/to bytecode is unsafe. Therefore we
return the function's type as an anonymous function ('lambda') or named
function in the Python environment ('function'). In the latter case, this lets
us use the Python scope to obtain the function rather than reload it from
bytecode. (Note that both cases are brittle!)
This serialization mimicks the implementation in tf.keras.layers.Lambda
.
Args |
func
|
Python function to serialize.
|
Returns |
(serial, function_type): Serialized object, which is a tuple of its
bytecode (if function is anonymous) or name (if function is named), and its
function type.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-11-21 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-11-21 UTC."],[],[]]