WIP Add custom KL loss layer HLS implementation
Created by: katyagovorkova
Adds an implementation of the KL loss layer used for CMS Anomaly detection at L1.
Adds an example of usage of KL layer is in contrib/kl_layer.py
and the HLS
part is in hls4ml/templates/vivado/nnet_utils/nnet_distance.h
.
The original implementation of the KL layer is available on the AE_L1_paper
branch, this PR updates the implementation for the new layer API.
Type of change
-
Documentation update -
New feature (non-breaking change which adds functionality)
Tests
The test creates a dummy Keras model which includes the KL loss layer, converts it to an hls4ml
model
and synthesises it.
Test Configuration:
To run the test do python contrib/kl_layer.py
Checklist
-
I have read the guidelines for contributing. -
I have commented my code, particularly in hard-to-understand areas. -
I have made corresponding changes to the documentation. -
My changes generate no new warnings. -
I have added tests that prove my fix is effective or that my feature works.