def encode_overlapping_binary_jit(n_inputnodes, nr_samples, lengths, out, positions):
# out: float32[:,:,:] with [samples, timesteps, features]
# pos_ind: int64 at which position in out['features'] the position
# is stored and encoding should start
# lengths: lengths without tickersteps - tickersteps will be added here
mask = 1
n_bits = (n_inputnodes / 2) + 1 #lowbit only in binary
for s_i in range(nr_samples):
# Enocde position
for t_i in range(lengths[s_i]):
# normal bitwise for all bits
for n_i in range(n_bits):
out[s_i, t_i, n_i-n_inputnodes] = ((mask << n_i) & positions[s_i, t_i]) != 0
# overlapping bitwise (low bit ignored)
for n_i in range(1, n_bits):
# for bit at bitposition bp add 2**(bp-1) = 1<<(bp-1)
out[s_i, t_i, n_i-n_bits] = ((mask << n_i) & (positions[s_i, t_i] + (mask << (n_i-1)))) != 0
input_encoders_numba.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录