5173511e33cc476c1c2f53683ba2bf0b5f0dbf00,hls4ml/converters/keras/qkeras_parsing.py,,parse_qactivation_layer,#Any#Any#Any#Any#Any#,47

Before Change



    layer["class_name"] = "Activation"
    layer["activation"] = act_class.replace("quantized_", "")
    layer["bits"] = activation_config["config"]["bits"] + 1
    layer["integer"] = activation_config["config"]["integer"] + 1
    //TODO this needs extra work in HLS model and HLS templates

After Change


        quantizer_obj = get_quantizer(activation_config)
        activation_config = {}
        // some activations are classes 
        if hasattr(quantizer_obj, "get_config"):
            print("Name: " + quantizer_obj.__class__.__name__)
            activation_config["class_name"] = quantizer_obj.__class__.__name__
            activation_config["config"] = quantizer_obj.get_config()
        // some activation quantizers are just functions with no config
        else:
            activation_config["config"] = {}
            if quantizer_obj.__name__ == "binary_tanh":
                activation_config["class_name"] = "binary_tanh"
                activation_config["config"]["bits"] = 1
                activation_config["config"]["integer"] = 1
            elif quantizer_obj.__name__ == "ternary_tanh":
                activation_config["class_name"] = "ternary_tanh"
                activation_config["config"]["bits"] = 2
                activation_config["config"]["integer"] = 2
            else:
                activation_config["class_name"] = "unknown"
    
    if activation_config["class_name"] not in supported_activations:
        raise Exception("Unsupported QKeras activation: {}".format(activation_config["class_name"]))

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: hls-fpga-machine-learning/hls4ml
Commit Name: 5173511e33cc476c1c2f53683ba2bf0b5f0dbf00
Time: 2020-05-27
Author: sioni.summers10@imperial.ac.uk
File Name: hls4ml/converters/keras/qkeras_parsing.py
Class Name:
Method Name: parse_qactivation_layer


Project Name: NeuromorphicProcessorProject/snn_toolbox
Commit Name: e22aef4d42d1d20a093240933181f627dcd830e7
Time: 2016-10-13
Author: bodo.rueckauer@gmail.com
File Name: snntoolbox/core/inisim.py
Class Name:
Method Name: update_neurons


Project Name: MolSSI/QCEngine
Commit Name: 83d44096d850acd386dd466d377d0b5ee2cc0be5
Time: 2018-06-30
Author: malorian@me.com
File Name: qcengine/config.py
Class Name:
Method Name: