我有一个模型,我想把它移植到微芯片上。但是,当我运行代码时,它会给出以下错误:
没有为内置操作系统“TRANSPOSE”版本“2”找到op
未能从op代码d获得注册
我假设tflite微系统不支持转置功能。我也尝试用一个永久层替换它,但它似乎使用了遮罩下的tf.transpose。下面是我的模型中我尝试转换的部分:
output = tf.reshape(output, (img_width // B, B, img_height // B, B), name="reshape_in")
output = Permute((2, 1, 3), name="transpose_in")(output)还有其他方法可以不调用tf.transpose来执行这个转置吗?也许用整形术?
发布于 2021-07-26 08:28:43
在尝试使用TFLite的GPU委托运行模型时,我遇到了类似的问题,该模型不支持转置操作。
一种可能是使用条带、tf.reshape和concat操作的组合:
shape = (3,4,5)
a = tf.random.uniform(shape)
a_t = tf.transpose(a,(1,0,2)) # permuting first and second axis
a_concat = tf.concat([tf.reshape(a[i:i+1,:,:],(shape[1],1,shape[2])) for i in range(shape[0])],axis=1)
tf.debugging.assert_equal(a_t,a_concat)备注:
delegate
tf.concat,因为在GPU委托的PACK/tf.stack,它使用的是a[i:i+1,:]而不是a[i],因为GPU H 216f<217/code>https://stackoverflow.com/questions/68295424
复制相似问题