Tensorflow Keras utilities for reducing boilerplate code.
Project description
TensorFlow Keras utilities and helpers for building custom layers by reducing boilerplate code.
LICENSE
MIT. See License File.
Install
params-flow is on the Python Package Index (PyPI):
pip install params-flow
Usage
params-flow provides a Layer class that helps reducing common boilerplate code when writing custom Keras layers.
Instead of defining your layer parameters in __init(), define them in a Params class like this:
class MyLayer(params_flow.Layer):
Params(params_flow.Layer.Params):
hidden_size = 128
activation = "gelu"
After extending the params.flow.Layer like above, the base class will take care for serializing your layer configuration, and will spare you from coding comon keras boilerplate code like:
class MyLayer(keras.Layer):
def __init__(self, hidden_size=128, activation="gelu"):
super(MyLayer, self).__init__()
self.hidden_size = hidden_size
self.activation = activation
def get_config(self):
config = {
"hidden_size": self.hidden_size,
"activation": self.activation,
}
base_config = super(MyLayer, self).get_config()
return dict(list(base_config.items()) + list(config.items()))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
params-flow-0.0.4.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for params_flow-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af28c49adee98c337d236f87f34d72d00fcb3f1f827d0ccfc97c26201cf3f1f5 |
|
MD5 | cd6396a39534293e8ba07107532f1224 |
|
BLAKE2b-256 | f9ea2df18a226c11ff7ff4774f55191225f1f90bcbab6f61be03109711b472bb |