Title: `test_softmax.py` does not test `argmax` and `latency` implementations; `latency` fails · Issue #1443 · fastmachinelearning/hls4ml · GitHub
Open Graph Title: `test_softmax.py` does not test `argmax` and `latency` implementations; `latency` fails · Issue #1443 · fastmachinelearning/hls4ml
X Title: `test_softmax.py` does not test `argmax` and `latency` implementations; `latency` fails · Issue #1443 · fastmachinelearning/hls4ml
Description: Quick summary test_softmax.py does not actually test non-default implementations (argmax and latency). If we fix that, tests for latency fail, reporting low accuracy. Details Steps to Reproduce Clone the hls4ml repository Checkout the ma...
Open Graph Description: Quick summary test_softmax.py does not actually test non-default implementations (argmax and latency). If we fix that, tests for latency fail, reporting low accuracy. Details Steps to Reproduce Clo...
X Description: Quick summary test_softmax.py does not actually test non-default implementations (argmax and latency). If we fix that, tests for latency fail, reporting low accuracy. Details Steps to Reproduce Clo...
Opengraph URL: https://github.com/fastmachinelearning/hls4ml/issues/1443
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`test_softmax.py` does not test `argmax` and `latency` implementations; `latency` fails","articleBody":"## Quick summary\n1. `test_softmax.py` does not actually test non-default implementations (`argmax` and `latency`).\n2. If we fix that, tests for `latency` fail, reporting low accuracy.\n\n## Details\n\n### Steps to Reproduce\n\n1. Clone the hls4ml repository\n2. Checkout the main branch, commit hash: 6900257f\n3. Run `pytest test/pytest/test_softmax.py`\n4. Go e.g. to `test/pytest/test_softmax_test_softmax_9,6-input_shape6-18,8-io_parallel-False-latency-Vivado/parameters.h`, line 29, see:\n```\n static const nnet::softmax_implementation implementation = nnet::softmax_implementation::stable;\n```\ninstead of expected `nnet::softmax_implementation::latency`.\n\n5. Now, if we replace the line\nhttps://github.com/fastmachinelearning/hls4ml/blob/6900257ff794958b834afbaa41e7c75821d3094e/test/pytest/test_softmax.py#L47\nwith\n```\n cfg['LayerName']['softmax']['implementation'] = strategy\n```\nthen all `latency` tests fail with messages like:\n```\nAccuracy hls4ml relative to keras: 0.1908\n```\n\n6. Now, if we replace https://github.com/fastmachinelearning/hls4ml/blob/6900257ff794958b834afbaa41e7c75821d3094e/test/pytest/test_softmax.py#L19\nwith\n```\n return np.clip(d, -32, 0)\n```\nthe the tests pass.\n\n(Catapult backend fails on my laptop because it doesn't create .so file, but that's unrelated).","author":{"url":"https://github.com/vasdommes","@type":"Person","name":"vasdommes"},"datePublished":"2026-02-19T21:00:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1443/hls4ml/issues/1443"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:28b93832-df17-bb41-7279-68dd3a367b15 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CC78:1B1570:A8C8A:E71B0:6A4BBFDD |
| html-safe-nonce | ea846fb6cb426368cda3ff8750470298f55500df08afa815b51aee1495371a67 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzc4OjFCMTU3MDpBOEM4QTpFNzFCMDo2QTRCQkZERCIsInZpc2l0b3JfaWQiOiIyOTI2MTM0OTY1NDEzMDY4NzY1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ebf743130fd7ab90c18764d3c6291e621c10da8cbe93ab304917482f3125c111 |
| hovercard-subject-tag | issue:3965078950 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/fastmachinelearning/hls4ml/1443/issue_layout |
| twitter:image | https://opengraph.githubassets.com/109958bbb7f0f7180c7b88c24ebe9339fe364c6828e49e4cc84173bf33154b46/fastmachinelearning/hls4ml/issues/1443 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/109958bbb7f0f7180c7b88c24ebe9339fe364c6828e49e4cc84173bf33154b46/fastmachinelearning/hls4ml/issues/1443 |
| og:image:alt | Quick summary test_softmax.py does not actually test non-default implementations (argmax and latency). If we fix that, tests for latency fail, reporting low accuracy. Details Steps to Reproduce Clo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vasdommes |
| hostname | github.com |
| expected-hostname | github.com |
| None | ae1c14875555a1dd92bdef45baa6dd9aa796df891e4e471989f7117fe3139fc1 |
| turbo-cache-control | no-preview |
| go-import | github.com/fastmachinelearning/hls4ml git https://github.com/fastmachinelearning/hls4ml.git |
| octolytics-dimension-user_id | 33101568 |
| octolytics-dimension-user_login | fastmachinelearning |
| octolytics-dimension-repository_id | 108329371 |
| octolytics-dimension-repository_nwo | fastmachinelearning/hls4ml |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 108329371 |
| octolytics-dimension-repository_network_root_nwo | fastmachinelearning/hls4ml |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b15c57117aeff522995a9578e1185f6c45d6c562 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width