Reputation: 116
I have bias for module my_dot which is Queue interface. Now, I would like to send this bias as init for accum but without EOT. How to do this?
@gear
def my_dot(din: Queue[Tuple[Fixp[9, 16], Fixp[9, 16]]], bias):
return din \
| queuemap(f=mul) \
| accum(init=din.dtype.data(bias)) \
| g_qround(fract=7) \
| g_saturate(t=Fixp[9, 16])
Upvotes: 1
Views: 23
Reputation: 321
You did it rightm the only thing you missed is firght number conversion. Instead using din.dtype.data use this:
@gear
def my_dot(din: Queue[Tuple[Fixp[9, 16], Fixp[9, 16]]], bias):
return din \
| queuemap(f=mul) \
| accum(init=bias | Fixp[18, 32]) \
| g_qround(fract=7) \
| g_saturate(t=Fixp[9, 16])
PyGears doesn't have a problem with Queue, framework knows what it should do, so he will drop of EOT and take only "Number".
Upvotes: 1