Comments (7)
A quick note if you are using the finn
compiler to produce the finn-hlslib
description: we have a ConvertSubToAdd
transformation that converts subtraction ops to add ops, which would handle this without any extra implementation: https://github.com/Xilinx/finn-base/blob/dev/src/finn/transformation/general.py#L233
(If you are manually putting together finn-hlslib
layers then what I wrote above does not apply)
from finn-hlslib.
Thanks for the response! Unfortunately, I am subtracting two unique streams. I assume I would need a block to invert the sign of one fo the streams then? Which is the better solution?
from finn-hlslib.
Hi, changing the API of AddStreams
could have implications in the finn
compiler, so I would advise against it.
I would suggest trying using the Thresholding_Batch
function (here) with the activation function std::negate
, that should allow you to perform sign inversion on a per-channel basis on one of the inputs allowing you to do a subtraction in 2 steps.
from finn-hlslib.
Sounds like a plan! Is there a method for doing that in FINN? A matching CustomOp?
from finn-hlslib.
This approach best discussed on the finn gitter channel as it's not an hlslib issue per se. Also feel free to open an issue on the finn
compiler repo with a minimal example and we can try to help formulate a way of making this work. But in summary:
If you express the subtraction of streams explicitly as a negate-and-add I believe this should be doable with existing transformations and CustomOps, namely InferChannelwiseLinearLayer
to convert standalone Mul by -1 into the CustomOp ChannelWiseOp_Batch
which is implemented with the Thresholding_Batch
function under the hood (https://github.com/Xilinx/finn/blob/master/src/finn/custom_op/fpgadataflow/channelwise_op_batch.py). Followed by appropriate transformations to infer the AddStreams
.
from finn-hlslib.
Thanks for the help!
from finn-hlslib.
Thanks for the help!
from finn-hlslib.
Related Issues (19)
- New MVA Stream Unit with int2 inputs HOT 1
- Conv1D support HOT 2
- Using ap_fixed for convolution HOT 1
- Does torch. tok support conversion?
- UpsampleNearestNeighbour bug when Padding=scale_factor
- fatal error: memdata.h HOT 2
- ConvolutionInputGenerator is broken if OFMDim > 1
- LabelSelect_Batch stream output type HOT 1
- W1 type HOT 2
- Test results for WIDTH*SIMD greater than 64 are not accurate HOT 1
- vivado_hls version for testbench HOT 9
- No matching function call HOT 2
- add hardware IP HOT 1
- ERROR: [SIM 211-100] Csim failed with error HOT 1
- Testbench_conv Synthesis error HOT 1
- RTL simulation not finishing HOT 1
- Sliding Window testbench not working with stride = 1 HOT 2
- Add optional per-channel negation prior to thresholding HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from finn-hlslib.