Skip to main content

Tensorflow Keras utilities for reducing boilerplate code.

Project description

Build Status Coverage Status Version Status Python Versions

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


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

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page