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.1.2.tar.gz
(4.2 kB
view hashes)