peterjc123
peterjc123
@quhaoooo 参考这里 https://github.com/alibaba/TinyNeuralNetwork/blob/main/tinynn/converter/operators/torch/__init__.py#L189 ,就是不需要设置成不需要追踪的op就好了
> 好的,请问一下这两个算子为什么是可以设置成不需要跟踪, 因为他跟输入没关系啊,新生成了一个常量 > 另外至于fill_呢。 感谢 你是要实现吗?可以参考 https://github.com/alibaba/TinyNeuralNetwork/blob/main/docs/FAQ_zh-CN.md#%E7%AE%97%E5%AD%90%E4%B8%8D%E6%94%AF%E6%8C%81%E5%A6%82%E4%BD%95%E5%A4%84%E7%90%86 pytorch里的 fill 就是对应 tflite 的 fill
@quhaoooo 话说其实fill产生的也是常量,schema里面没有是因为之前我们生成schema的时候过滤了大部分inplace的tensor操作。我们不完全支持inplace的操作,尤其是 对于某个tensor的一部分(使用slice或者select)做inplace操作的那就更不支持了。当然这都是对于变量来说了,常量不受任何影响。 > 新生成的变量不需要跟踪,但是通过您的代码也会转成tfl是吧? 会正常利用torchscript中的步骤计算其值,但是不会加入tflite计算图,直到遇到第一个包含变量输入且使用某常量值的op,在此时他会以常量加入计算图。(这个过程一般被称为常量折叠,constant folding,有兴趣的话可以自己了解下)
未添加的op已经记录在 https://github.com/alibaba/TinyNeuralNetwork/issues/123 中了
@gj-raza This is currently unsupported. We will take a look later. This shouldn't be too difficult I guess.
@gj-raza Is [`torchvision.ops.nms`](https://pytorch.org/vision/stable/ops.html#torchvision.ops.nms) sufficient for your usage?
> Also i've noticed, TFLite's NMS v4 and v5, exisits in your code [here](https://github.com/alibaba/TinyNeuralNetwork/blob/main/tinynn/converter/operators/tflite/generated_ops.py) , can you please explain what is the overall flow of tinynn converter. so that i...
@gj-raza I've done the first two tasks. If you are interested, you may take a look at the latter two, which should be fairly easy.
@gj-raza As for the PyTorch side, the schema is quite clear. https://github.com/alibaba/TinyNeuralNetwork/blob/main/tinynn/converter/operators/torch/torchvision_schema.py#L40 https://pytorch.org/vision/stable/ops.html#torchvision.ops.nms With regard to the TFLite side, you may refer to the following docs. https://www.tensorflow.org/mlir/tfl_ops#tflnon_max_suppression_v4_mlirtflnonmaxsuppressionv4op https://www.tensorflow.org/api_docs/python/tf/image/non_max_suppression_padded https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/kernels/non_max_suppression.cc#L29-L60 To...
> Hi, The [`torchvision::ops::batched_nms`](https://pytorch.org/vision/stable/ops.html#torchvision.ops.batched_nms) in PyTorch looks like the [`tensorflow::ops::combined-non-max-suppression`](https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/combined-non-max-suppression) (set the `q` to 1) in Tensorflow (I'm not sure about this numerical equivalence and I should do some verification...