triggerflow 0.2.7__py3-none-any.whl → 0.2.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
triggerflow/core.py CHANGED
@@ -87,6 +87,15 @@ class HLS4MLStrategy(CompilerStrategy):
87
87
  for key in ["project_name", "namespace", "io_type", "backend", "write_weights_txt"]:
88
88
  if key in config:
89
89
  hls_kwargs[key] = config[key]
90
+
91
+ if config and "Model" in config:
92
+ for key, value in config["Model"].items():
93
+ if isinstance(value, dict):
94
+ for layer, layer_config in value.items():
95
+ if layer in hls_config["LayerName"]:
96
+ hls_config["LayerName"][layer][key] = layer_config
97
+ else:
98
+ hls_config["Model"][key] = value
90
99
 
91
100
  firmware_model = hls4ml.converters.convert_from_keras_model(
92
101
  model,
@@ -123,6 +132,7 @@ class ConiferStrategy(CompilerStrategy):
123
132
  cfg['ProjectName'] = config['project_name']
124
133
  cfg['XilinxPart'] = config['fpga_part']
125
134
  cfg['ClockPeriod'] = config['clock_period']
135
+ cfg['Precision'] = config['Precision']
126
136
 
127
137
  if config:
128
138
  for key, value in config.items():
@@ -59,21 +59,10 @@ void {{MODEL_NAME}}_GT(
59
59
  input_t input_scaled[{{N_INPUTS}}];
60
60
  int idx = 0;
61
61
 
62
- // Muons
63
- for (int i = 0; i < {{MUON_SIZE}}; i++) {
64
- #pragma HLS unroll
65
- {% for f in MUON_FEATURES %}
66
- input_unscaled[idx++] = muons[i].{{f}};
67
- {% endfor %}
68
- }
69
-
70
- // Jets
71
- for (int i = 0; i < {{JET_SIZE}}; i++) {
72
- #pragma HLS unroll
73
- {% for f in JET_FEATURES %}
74
- input_unscaled[idx++] = jets[i].{{f}};
75
- {% endfor %}
76
- }
62
+ // Scalars / global objects FIRST
63
+ {% for f in GLOBAL_FEATURES %}
64
+ input_unscaled[idx++] = {{f}};
65
+ {% endfor %}
77
66
 
78
67
  // EGammas
79
68
  for (int i = 0; i < {{EGAMMA_SIZE}}; i++) {
@@ -83,6 +72,14 @@ void {{MODEL_NAME}}_GT(
83
72
  {% endfor %}
84
73
  }
85
74
 
75
+ // Muons
76
+ for (int i = 0; i < {{MUON_SIZE}}; i++) {
77
+ #pragma HLS unroll
78
+ {% for f in MUON_FEATURES %}
79
+ input_unscaled[idx++] = muons[i].{{f}};
80
+ {% endfor %}
81
+ }
82
+
86
83
  // Taus
87
84
  for (int i = 0; i < {{TAU_SIZE}}; i++) {
88
85
  #pragma HLS unroll
@@ -91,14 +88,17 @@ void {{MODEL_NAME}}_GT(
91
88
  {% endfor %}
92
89
  }
93
90
 
94
- // Scalars / global objects
95
- {% for f in GLOBAL_FEATURES %}
96
- input_unscaled[idx++] = {{f}};
97
- {% endfor %}
91
+ // Jets
92
+ for (int i = 0; i < {{JET_SIZE}}; i++) {
93
+ #pragma HLS unroll
94
+ {% for f in JET_FEATURES %}
95
+ input_unscaled[idx++] = jets[i].{{f}};
96
+ {% endfor %}
97
+ }
98
98
 
99
99
  scaleNNInputs(input_unscaled, input_scaled);
100
100
 
101
101
  {{MODEL_NAME}}_project(input_scaled, {{OUT}});
102
102
  }
103
103
 
104
- } // namespace {{MODEL_NAME}}
104
+ } // namespace {{MODEL_NAME}}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: triggerflow
3
- Version: 0.2.7
3
+ Version: 0.2.9
4
4
  Summary: Utilities for ML models targeting hardware triggers
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -6,7 +6,7 @@ trigger_loader/loader.py,sha256=wMkeZ3k36wpxt-B8OpKOa6j7z0-fnJUqQ-5AbVjNpBM,5158
6
6
  trigger_loader/processor.py,sha256=cvBfYmvcr4FLzOHgGE50oy7EkFzFaV80Z_66amqfsEY,7724
7
7
  triggerflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  triggerflow/cli.py,sha256=ZNQb3XQN8Ir6Hp6KX_ugec9bm2kqxLNZ0KdVGJmnqFA,4498
9
- triggerflow/core.py,sha256=WlIYCKzd2NQJlr8Rw2t9zFvvNPZUlWMEIgkU-ov2E3E,22228
9
+ triggerflow/core.py,sha256=LzVEZ5cFe5U8WroDGRC0eetCbMw0xyQlEp-AEFWkTp8,22701
10
10
  triggerflow/mlflow_wrapper.py,sha256=yCaIS-H7oC2KxnExj24ka9ylF4A1wgzRIpc7Y43ervI,10667
11
11
  triggerflow/interfaces/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  triggerflow/interfaces/uGT.py,sha256=aPIYorMrISie1-BSUr-ywWF5AvHruGhGx4ibg21sCMs,4014
@@ -92,11 +92,11 @@ triggerflow/templates/build_ugt.tcl,sha256=P1y42s9Ju6zDyRskCVlD-vSnblAmTafw7Jpzs
92
92
  triggerflow/templates/data_types.h,sha256=m7_jLsRixSVjp8auxHZUUNAcSO777C5TTZl__9ENk90,12640
93
93
  triggerflow/templates/makefile,sha256=A-aetsLC51Bop0T_-yPY8Z8Hg29ApN4YPvKx_jjPuHw,970
94
94
  triggerflow/templates/makefile_version,sha256=6kFc_u2oiM9l2rH7RK_BLzdZu1ZEK8PQTQKGBLRY0v4,328
95
- triggerflow/templates/model-gt.cpp,sha256=qZwuTtsvrKB_mOB-HDb2uOD7mDo4-20EjFiQzRjMdPo,2969
95
+ triggerflow/templates/model-gt.cpp,sha256=zceVNNIvHx0EK1SoyBglC-1mR_l8q-HrSCFx9-lKE0I,2974
96
96
  triggerflow/templates/model_template.cpp,sha256=Uh80AwDAcFlseonEwV7_HqD85ALs0IPG5JfVT204d5k,1887
97
97
  triggerflow/templates/scales.h,sha256=MFcB5S0DEvfzHuUhyZqILR0O4ktugOG-fLnuCDUUewM,373
98
- triggerflow-0.2.7.dist-info/METADATA,sha256=vp6187RdnsGgdanBTqvY6jifqZmOZ8JoN92wGT7tBbM,5535
99
- triggerflow-0.2.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
100
- triggerflow-0.2.7.dist-info/entry_points.txt,sha256=5QSV9YDseB_FqgVh9q10BdL4b1I6t68rGwPLXgVL60g,53
101
- triggerflow-0.2.7.dist-info/top_level.txt,sha256=cX0jkuM9tfxGp002ZBQ1AYgx-6D_NgBtomgPL0WA9bE,43
102
- triggerflow-0.2.7.dist-info/RECORD,,
98
+ triggerflow-0.2.9.dist-info/METADATA,sha256=gLTU8WCRsolsVdg3hgkjDgq-I5MJTMZXStKXXlffE3w,5535
99
+ triggerflow-0.2.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
100
+ triggerflow-0.2.9.dist-info/entry_points.txt,sha256=5QSV9YDseB_FqgVh9q10BdL4b1I6t68rGwPLXgVL60g,53
101
+ triggerflow-0.2.9.dist-info/top_level.txt,sha256=cX0jkuM9tfxGp002ZBQ1AYgx-6D_NgBtomgPL0WA9bE,43
102
+ triggerflow-0.2.9.dist-info/RECORD,,