[Python API Mismatch!] Bitpacking mismatch between VTA and standard?

Hello all,

I have been looking at BitPacking and I cant seem to solve my doubts for myself.

First of all, I found the registration of the Relay operator in /src/relay/op/nn/bitserial.cc.

Then I found 2 compute implementations

Now, I can live with the fact of 2 different computes being defined for the same Relay opertor, since the second one is VTA specific.

My problem is more related to the Input Output Relations defined in /src/relay/op/nn/bitserial.cc.

  1. If what i know is true, that VTA bitpack operation reuses this BitPackRel function at the Relay level (for InferType passes). Right?
  2. The Python API states that bit_axis is per default 2, this would lead to the tensor being expanded by one dimension (standard op and relation function match). Nevertheless, the VTA implementation doesnt do this. Why doesnt this lead to some kind of mismatch between expected tensor shape and returned tensor shape?
  3. Is there a way to define {OP}Rel functions on the Python side? I only see them in the C++ side
  4. What exactly is the difference between and “Injective” and an “Elemwise” operator? I noticed that many layout transform operators are of the Injective type, but other than that I can’t seem to find more information

@thierry since you are the main developer of the VTA side, I would be interested in your feedback

Thanks all

I just saw that the Python API specifying that bit_axis=2 per default has a mismatch to the implemented Relay BitPackAttrs specification ot bit_axis=-1 per default

With that questions 1 and 2 are answered. Still looking for answers of 3 and 4