onnx2tf 1.29.17__tar.gz → 1.29.18__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/PKG-INFO +13 -12
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/README.md +12 -11
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/__init__.py +1 -1
- onnx2tf-1.29.18/onnx2tf/ops/ImageDecoder.py +147 -0
- onnx2tf-1.29.18/onnx2tf/ops/NegativeLogLikelihoodLoss.py +237 -0
- onnx2tf-1.29.18/onnx2tf/ops/RMSNormalization.py +175 -0
- onnx2tf-1.29.18/onnx2tf/ops/RegexFullMatch.py +108 -0
- onnx2tf-1.29.18/onnx2tf/ops/RotaryEmbedding.py +285 -0
- onnx2tf-1.29.18/onnx2tf/ops/Scan.py +438 -0
- onnx2tf-1.29.18/onnx2tf/ops/SoftmaxCrossEntropyLoss.py +289 -0
- onnx2tf-1.29.18/onnx2tf/ops/StringConcat.py +128 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/StringNormalizer.py +54 -39
- onnx2tf-1.29.18/onnx2tf/ops/StringSplit.py +156 -0
- onnx2tf-1.29.18/onnx2tf/ops/TensorScatter.py +223 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/pyproject.toml +1 -1
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/__main__.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/onnx2tf.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Abs.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Acos.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Acosh.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Add.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/AffineGrid.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/And.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ArgMax.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ArgMin.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Asin.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Asinh.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Atan.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Atanh.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Attention.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/AveragePool.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/BatchNormalization.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Bernoulli.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/BitShift.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/BitwiseAnd.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/BitwiseNot.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/BitwiseOr.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/BitwiseXor.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/BlackmanWindow.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Cast.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Ceil.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Celu.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Clip.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Col2Im.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Compress.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Concat.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ConcatFromSequence.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Constant.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ConstantOfShape.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Conv.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ConvInteger.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ConvTranspose.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Cos.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Cosh.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/CumProd.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/CumSum.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/DepthToSpace.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/DequantizeLinear.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Det.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Div.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Dropout.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/DynamicQuantizeLinear.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Einsum.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Elu.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Equal.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Erf.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Exp.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Expand.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/EyeLike.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Flatten.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Floor.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/FusedConv.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/GRU.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Gather.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/GatherElements.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/GatherND.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Gelu.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Gemm.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/GlobalAveragePool.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/GlobalLpPool.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/GlobalMaxPool.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Greater.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/GreaterOrEqual.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/GridSample.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/GroupNorm.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/HammingWindow.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/HannWindow.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/HardSigmoid.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/HardSwish.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Hardmax.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Identity.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/If.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Input.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/InstanceNormalization.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Inverse.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/IsInf.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/IsNaN.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/LRN.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/LSTM.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/LayerNormalization.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/LeakyRelu.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Less.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/LessOrEqual.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Log.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/LogSoftmax.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Loop.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/LpNormalization.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/LpPool.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/MatMul.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/MatMulInteger.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Max.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/MaxPool.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/MaxRoiPool.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/MaxUnpool.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Mean.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/MeanVarianceNormalization.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/MelWeightMatrix.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Min.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Mish.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Mod.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Mul.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Multinomial.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Neg.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/NonMaxSuppression.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/NonZero.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Not.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/OneHot.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/OptionalGetElement.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/OptionalHasElement.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Or.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/PRelu.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Pad.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Pow.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/QLinearAdd.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/QLinearConcat.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/QLinearConv.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/QLinearLeakyRelu.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/QLinearMatMul.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/QLinearMul.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/QLinearSigmoid.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/QLinearSoftmax.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/QuantizeLinear.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/RNN.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/RandomNormal.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/RandomNormalLike.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/RandomUniform.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/RandomUniformLike.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Range.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Reciprocal.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ReduceL1.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ReduceL2.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ReduceLogSum.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ReduceLogSumExp.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ReduceMax.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ReduceMean.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ReduceMin.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ReduceProd.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ReduceSum.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ReduceSumSquare.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Relu.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Reshape.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Resize.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ReverseSequence.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/RoiAlign.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Round.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/STFT.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ScaleAndTranslate.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Scatter.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ScatterElements.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ScatterND.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Selu.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/SequenceAt.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/SequenceConstruct.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/SequenceEmpty.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/SequenceErase.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/SequenceInsert.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/SequenceLength.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Shape.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Shrink.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Sigmoid.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Sign.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Sin.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Sinh.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Size.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Slice.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Softmax.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Softplus.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Softsign.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/SpaceToDepth.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Split.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/SplitToSequence.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Sqrt.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Squeeze.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Sub.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Sum.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Tan.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Tanh.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/ThresholdedRelu.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Tile.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/TopK.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Transpose.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Trilu.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Unique.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Unsqueeze.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Upsample.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Where.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/Xor.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/ops/__init__.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/utils/__init__.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/utils/common_functions.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/utils/enums.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/utils/iterative_json_optimizer.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/utils/json_auto_generator.py +0 -0
- {onnx2tf-1.29.17 → onnx2tf-1.29.18}/onnx2tf/utils/logging.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: onnx2tf
|
|
3
|
-
Version: 1.29.
|
|
3
|
+
Version: 1.29.18
|
|
4
4
|
Summary: Self-Created Tools to convert ONNX files (NCHW) to TensorFlow/TFLite/Keras format (NHWC). The purpose of this tool is to solve the massive Transpose extrapolation problem in onnx-tensorflow (onnx-tf).
|
|
5
5
|
Keywords: onnx,tensorflow,tflite,keras,deep-learning,machine-learning
|
|
6
6
|
Author: Katsuya Hyodo
|
|
@@ -175,7 +175,7 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
|
|
|
175
175
|
|HardSwish|:heavy_check_mark:|
|
|
176
176
|
|Identity|:heavy_check_mark:|
|
|
177
177
|
|If|:heavy_check_mark:|
|
|
178
|
-
|ImageDecoder
|
|
178
|
+
|ImageDecoder|:white_check_mark:|
|
|
179
179
|
|Input|:heavy_check_mark:|
|
|
180
180
|
|InstanceNormalization|:heavy_check_mark:|
|
|
181
181
|
|Inverse|:heavy_check_mark:|
|
|
@@ -207,7 +207,7 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
|
|
|
207
207
|
|Mul|:heavy_check_mark:|
|
|
208
208
|
|Multinomial|:heavy_check_mark:|
|
|
209
209
|
|Neg|:heavy_check_mark:|
|
|
210
|
-
|NegativeLogLikelihoodLoss
|
|
210
|
+
|NegativeLogLikelihoodLoss|:heavy_check_mark:|
|
|
211
211
|
|NonMaxSuppression|:heavy_check_mark:|
|
|
212
212
|
|NonZero|:heavy_check_mark:|
|
|
213
213
|
|Optional|**Help wanted**|
|
|
@@ -244,19 +244,20 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
|
|
|
244
244
|
|ReduceProd|:heavy_check_mark:|
|
|
245
245
|
|ReduceSum|:heavy_check_mark:|
|
|
246
246
|
|ReduceSumSquare|:heavy_check_mark:|
|
|
247
|
+
|RegexFullMatch|:heavy_check_mark:|
|
|
247
248
|
|Relu|:heavy_check_mark:|
|
|
248
249
|
|Reshape|:heavy_check_mark:|
|
|
249
250
|
|Resize|:heavy_check_mark:|
|
|
250
251
|
|ReverseSequence|:heavy_check_mark:|
|
|
251
252
|
|RNN|:heavy_check_mark:|
|
|
252
253
|
|RoiAlign|:heavy_check_mark:|
|
|
253
|
-
|RotaryEmbedding
|
|
254
|
+
|RotaryEmbedding|:heavy_check_mark:|
|
|
254
255
|
|Round|:heavy_check_mark:|
|
|
255
256
|
|ScaleAndTranslate|:heavy_check_mark:|
|
|
256
257
|
|Scatter|:heavy_check_mark:|
|
|
257
258
|
|ScatterElements|:heavy_check_mark:|
|
|
258
259
|
|ScatterND|:heavy_check_mark:|
|
|
259
|
-
|Scan
|
|
260
|
+
|Scan|:heavy_check_mark:|
|
|
260
261
|
|Selu|:heavy_check_mark:|
|
|
261
262
|
|SequenceAt|:heavy_check_mark:|
|
|
262
263
|
|SequenceConstruct|:heavy_check_mark:|
|
|
@@ -273,7 +274,7 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
|
|
|
273
274
|
|Size|:heavy_check_mark:|
|
|
274
275
|
|Slice|:heavy_check_mark:|
|
|
275
276
|
|Softmax|:heavy_check_mark:|
|
|
276
|
-
|SoftmaxCrossEntropyLoss
|
|
277
|
+
|SoftmaxCrossEntropyLoss|:heavy_check_mark:|
|
|
277
278
|
|Softplus|:heavy_check_mark:|
|
|
278
279
|
|Softsign|:heavy_check_mark:|
|
|
279
280
|
|SpaceToDepth|:heavy_check_mark:|
|
|
@@ -282,14 +283,14 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
|
|
|
282
283
|
|Sqrt|:heavy_check_mark:|
|
|
283
284
|
|Squeeze|:heavy_check_mark:|
|
|
284
285
|
|STFT|:white_check_mark:|
|
|
285
|
-
|StringConcat
|
|
286
|
-
|StringNormalizer|:
|
|
287
|
-
|StringSplit
|
|
286
|
+
|StringConcat|:heavy_check_mark:|
|
|
287
|
+
|StringNormalizer|:heavy_check_mark:|
|
|
288
|
+
|StringSplit|:heavy_check_mark:|
|
|
288
289
|
|Sub|:heavy_check_mark:|
|
|
289
290
|
|Sum|:heavy_check_mark:|
|
|
290
291
|
|Tan|:heavy_check_mark:|
|
|
291
292
|
|Tanh|:heavy_check_mark:|
|
|
292
|
-
|TensorScatter
|
|
293
|
+
|TensorScatter|:heavy_check_mark:|
|
|
293
294
|
|TfIdfVectorizer|**Help wanted**|
|
|
294
295
|
|ThresholdedRelu|:heavy_check_mark:|
|
|
295
296
|
|Tile|:heavy_check_mark:|
|
|
@@ -364,7 +365,7 @@ Video speed is adjusted approximately 50 times slower than actual speed.
|
|
|
364
365
|
docker run --rm -it \
|
|
365
366
|
-v `pwd`:/workdir \
|
|
366
367
|
-w /workdir \
|
|
367
|
-
ghcr.io/pinto0309/onnx2tf:1.29.
|
|
368
|
+
ghcr.io/pinto0309/onnx2tf:1.29.18
|
|
368
369
|
|
|
369
370
|
or
|
|
370
371
|
|
|
@@ -372,7 +373,7 @@ Video speed is adjusted approximately 50 times slower than actual speed.
|
|
|
372
373
|
docker run --rm -it \
|
|
373
374
|
-v `pwd`:/workdir \
|
|
374
375
|
-w /workdir \
|
|
375
|
-
docker.io/pinto0309/onnx2tf:1.29.
|
|
376
|
+
docker.io/pinto0309/onnx2tf:1.29.18
|
|
376
377
|
|
|
377
378
|
or
|
|
378
379
|
|
|
@@ -133,7 +133,7 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
|
|
|
133
133
|
|HardSwish|:heavy_check_mark:|
|
|
134
134
|
|Identity|:heavy_check_mark:|
|
|
135
135
|
|If|:heavy_check_mark:|
|
|
136
|
-
|ImageDecoder
|
|
136
|
+
|ImageDecoder|:white_check_mark:|
|
|
137
137
|
|Input|:heavy_check_mark:|
|
|
138
138
|
|InstanceNormalization|:heavy_check_mark:|
|
|
139
139
|
|Inverse|:heavy_check_mark:|
|
|
@@ -165,7 +165,7 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
|
|
|
165
165
|
|Mul|:heavy_check_mark:|
|
|
166
166
|
|Multinomial|:heavy_check_mark:|
|
|
167
167
|
|Neg|:heavy_check_mark:|
|
|
168
|
-
|NegativeLogLikelihoodLoss
|
|
168
|
+
|NegativeLogLikelihoodLoss|:heavy_check_mark:|
|
|
169
169
|
|NonMaxSuppression|:heavy_check_mark:|
|
|
170
170
|
|NonZero|:heavy_check_mark:|
|
|
171
171
|
|Optional|**Help wanted**|
|
|
@@ -202,19 +202,20 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
|
|
|
202
202
|
|ReduceProd|:heavy_check_mark:|
|
|
203
203
|
|ReduceSum|:heavy_check_mark:|
|
|
204
204
|
|ReduceSumSquare|:heavy_check_mark:|
|
|
205
|
+
|RegexFullMatch|:heavy_check_mark:|
|
|
205
206
|
|Relu|:heavy_check_mark:|
|
|
206
207
|
|Reshape|:heavy_check_mark:|
|
|
207
208
|
|Resize|:heavy_check_mark:|
|
|
208
209
|
|ReverseSequence|:heavy_check_mark:|
|
|
209
210
|
|RNN|:heavy_check_mark:|
|
|
210
211
|
|RoiAlign|:heavy_check_mark:|
|
|
211
|
-
|RotaryEmbedding
|
|
212
|
+
|RotaryEmbedding|:heavy_check_mark:|
|
|
212
213
|
|Round|:heavy_check_mark:|
|
|
213
214
|
|ScaleAndTranslate|:heavy_check_mark:|
|
|
214
215
|
|Scatter|:heavy_check_mark:|
|
|
215
216
|
|ScatterElements|:heavy_check_mark:|
|
|
216
217
|
|ScatterND|:heavy_check_mark:|
|
|
217
|
-
|Scan
|
|
218
|
+
|Scan|:heavy_check_mark:|
|
|
218
219
|
|Selu|:heavy_check_mark:|
|
|
219
220
|
|SequenceAt|:heavy_check_mark:|
|
|
220
221
|
|SequenceConstruct|:heavy_check_mark:|
|
|
@@ -231,7 +232,7 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
|
|
|
231
232
|
|Size|:heavy_check_mark:|
|
|
232
233
|
|Slice|:heavy_check_mark:|
|
|
233
234
|
|Softmax|:heavy_check_mark:|
|
|
234
|
-
|SoftmaxCrossEntropyLoss
|
|
235
|
+
|SoftmaxCrossEntropyLoss|:heavy_check_mark:|
|
|
235
236
|
|Softplus|:heavy_check_mark:|
|
|
236
237
|
|Softsign|:heavy_check_mark:|
|
|
237
238
|
|SpaceToDepth|:heavy_check_mark:|
|
|
@@ -240,14 +241,14 @@ https://github.com/PINTO0309/onnx2tf/wiki/model_status
|
|
|
240
241
|
|Sqrt|:heavy_check_mark:|
|
|
241
242
|
|Squeeze|:heavy_check_mark:|
|
|
242
243
|
|STFT|:white_check_mark:|
|
|
243
|
-
|StringConcat
|
|
244
|
-
|StringNormalizer|:
|
|
245
|
-
|StringSplit
|
|
244
|
+
|StringConcat|:heavy_check_mark:|
|
|
245
|
+
|StringNormalizer|:heavy_check_mark:|
|
|
246
|
+
|StringSplit|:heavy_check_mark:|
|
|
246
247
|
|Sub|:heavy_check_mark:|
|
|
247
248
|
|Sum|:heavy_check_mark:|
|
|
248
249
|
|Tan|:heavy_check_mark:|
|
|
249
250
|
|Tanh|:heavy_check_mark:|
|
|
250
|
-
|TensorScatter
|
|
251
|
+
|TensorScatter|:heavy_check_mark:|
|
|
251
252
|
|TfIdfVectorizer|**Help wanted**|
|
|
252
253
|
|ThresholdedRelu|:heavy_check_mark:|
|
|
253
254
|
|Tile|:heavy_check_mark:|
|
|
@@ -322,7 +323,7 @@ Video speed is adjusted approximately 50 times slower than actual speed.
|
|
|
322
323
|
docker run --rm -it \
|
|
323
324
|
-v `pwd`:/workdir \
|
|
324
325
|
-w /workdir \
|
|
325
|
-
ghcr.io/pinto0309/onnx2tf:1.29.
|
|
326
|
+
ghcr.io/pinto0309/onnx2tf:1.29.18
|
|
326
327
|
|
|
327
328
|
or
|
|
328
329
|
|
|
@@ -330,7 +331,7 @@ Video speed is adjusted approximately 50 times slower than actual speed.
|
|
|
330
331
|
docker run --rm -it \
|
|
331
332
|
-v `pwd`:/workdir \
|
|
332
333
|
-w /workdir \
|
|
333
|
-
docker.io/pinto0309/onnx2tf:1.29.
|
|
334
|
+
docker.io/pinto0309/onnx2tf:1.29.18
|
|
334
335
|
|
|
335
336
|
or
|
|
336
337
|
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import random
|
|
2
|
+
random.seed(0)
|
|
3
|
+
import numpy as np
|
|
4
|
+
np.random.seed(0)
|
|
5
|
+
import tensorflow as tf
|
|
6
|
+
import onnx_graphsurgeon as gs
|
|
7
|
+
import cv2
|
|
8
|
+
from onnx2tf.utils.common_functions import (
|
|
9
|
+
get_constant_or_variable,
|
|
10
|
+
print_node_info,
|
|
11
|
+
inverted_operation_enable_disable,
|
|
12
|
+
make_tf_node_info,
|
|
13
|
+
get_replacement_parameter,
|
|
14
|
+
pre_process_transpose,
|
|
15
|
+
post_process_transpose,
|
|
16
|
+
)
|
|
17
|
+
from onnx2tf.utils.logging import *
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _as_tensor(value):
|
|
21
|
+
if isinstance(value, np.ndarray):
|
|
22
|
+
return tf.convert_to_tensor(value)
|
|
23
|
+
if isinstance(value, (np.generic, int, float, bool, str, bytes)):
|
|
24
|
+
return tf.convert_to_tensor(value)
|
|
25
|
+
return value
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _decode_image_np(encoded_stream, pixel_format):
|
|
29
|
+
if encoded_stream is None:
|
|
30
|
+
return np.zeros((0, 0, 0), dtype=np.uint8)
|
|
31
|
+
if encoded_stream.dtype != np.uint8:
|
|
32
|
+
encoded_stream = encoded_stream.astype(np.uint8)
|
|
33
|
+
if encoded_stream.size == 0:
|
|
34
|
+
return np.zeros((0, 0, 0), dtype=np.uint8)
|
|
35
|
+
if encoded_stream.ndim != 1:
|
|
36
|
+
encoded_stream = encoded_stream.reshape(-1)
|
|
37
|
+
try:
|
|
38
|
+
if pixel_format == 'Grayscale':
|
|
39
|
+
flag = cv2.IMREAD_GRAYSCALE
|
|
40
|
+
else:
|
|
41
|
+
flag = cv2.IMREAD_COLOR
|
|
42
|
+
decoded = cv2.imdecode(encoded_stream, flag)
|
|
43
|
+
if decoded is None:
|
|
44
|
+
raise ValueError('cv2.imdecode failed')
|
|
45
|
+
if pixel_format == 'RGB':
|
|
46
|
+
decoded = cv2.cvtColor(decoded, cv2.COLOR_BGR2RGB)
|
|
47
|
+
if pixel_format == 'Grayscale' and decoded.ndim == 2:
|
|
48
|
+
decoded = decoded[..., np.newaxis]
|
|
49
|
+
return decoded.astype(np.uint8)
|
|
50
|
+
except Exception:
|
|
51
|
+
if pixel_format == 'Grayscale':
|
|
52
|
+
return np.zeros((0, 0, 1), dtype=np.uint8)
|
|
53
|
+
return np.zeros((0, 0, 3), dtype=np.uint8)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@print_node_info
|
|
57
|
+
@inverted_operation_enable_disable
|
|
58
|
+
@get_replacement_parameter
|
|
59
|
+
def make_node(
|
|
60
|
+
*,
|
|
61
|
+
graph_node: gs.Node,
|
|
62
|
+
tf_layers_dict: dict,
|
|
63
|
+
**kwargs: dict,
|
|
64
|
+
):
|
|
65
|
+
"""ImageDecoder
|
|
66
|
+
|
|
67
|
+
Parameters
|
|
68
|
+
----------
|
|
69
|
+
graph_node: gs.Node
|
|
70
|
+
graph_surgeon Node
|
|
71
|
+
|
|
72
|
+
tf_layers_dict: dict
|
|
73
|
+
optype, shape, dtype, tensorflow graph
|
|
74
|
+
"""
|
|
75
|
+
before_op_output_shape_trans_1 = \
|
|
76
|
+
tf_layers_dict.get(graph_node.inputs[0].name, {}).get('before_op_output_shape_trans', True)
|
|
77
|
+
before_op_output_shape_trans = \
|
|
78
|
+
before_op_output_shape_trans_1
|
|
79
|
+
|
|
80
|
+
graph_node_input = get_constant_or_variable(
|
|
81
|
+
graph_node.inputs[0],
|
|
82
|
+
before_op_output_shape_trans,
|
|
83
|
+
)
|
|
84
|
+
graph_node_output: gs.Variable = graph_node.outputs[0]
|
|
85
|
+
shape = graph_node_output.shape
|
|
86
|
+
dtype = graph_node_output.dtype
|
|
87
|
+
|
|
88
|
+
input_tensor = tf_layers_dict[graph_node_input.name]['tf_node'] \
|
|
89
|
+
if isinstance(graph_node_input, gs.Variable) else graph_node_input
|
|
90
|
+
|
|
91
|
+
# Preserving Graph Structure (Dict)
|
|
92
|
+
tf_layers_dict[graph_node_output.name] = {
|
|
93
|
+
'optype': graph_node.op,
|
|
94
|
+
'shape': shape,
|
|
95
|
+
'dtype': dtype,
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
# Pre-process transpose
|
|
99
|
+
input_tensor = pre_process_transpose(
|
|
100
|
+
value_before_transpose=input_tensor,
|
|
101
|
+
param_target='inputs',
|
|
102
|
+
param_name=graph_node.inputs[0].name,
|
|
103
|
+
**kwargs,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
# Generation of TF OP
|
|
107
|
+
input_tensor = _as_tensor(input_tensor)
|
|
108
|
+
pixel_format = graph_node.attrs.get('pixel_format', 'RGB')
|
|
109
|
+
if pixel_format not in ['RGB', 'BGR', 'Grayscale']:
|
|
110
|
+
error(
|
|
111
|
+
f'ImageDecoder pixel_format={pixel_format} is not supported.\n' +
|
|
112
|
+
f'graph_node.name: {graph_node.name}'
|
|
113
|
+
)
|
|
114
|
+
pixel_format = 'RGB'
|
|
115
|
+
|
|
116
|
+
decoded = tf.numpy_function(
|
|
117
|
+
func=lambda x: _decode_image_np(x, pixel_format),
|
|
118
|
+
inp=[input_tensor],
|
|
119
|
+
Tout=tf.uint8,
|
|
120
|
+
name=graph_node.name,
|
|
121
|
+
)
|
|
122
|
+
channels = 1 if pixel_format == 'Grayscale' else 3
|
|
123
|
+
decoded = tf.ensure_shape(decoded, [None, None, channels])
|
|
124
|
+
tf_layers_dict[graph_node_output.name]['tf_node'] = decoded
|
|
125
|
+
|
|
126
|
+
# Post-process transpose
|
|
127
|
+
tf_layers_dict[graph_node_output.name]['tf_node'] = post_process_transpose(
|
|
128
|
+
value_before_transpose=tf_layers_dict[graph_node_output.name]['tf_node'],
|
|
129
|
+
param_target='outputs',
|
|
130
|
+
param_name=graph_node.outputs[0].name,
|
|
131
|
+
**kwargs,
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
# Generation of Debug Info
|
|
135
|
+
tf_layers_dict[graph_node_output.name]['tf_node_info'] = \
|
|
136
|
+
make_tf_node_info(
|
|
137
|
+
node_info={
|
|
138
|
+
'tf_op_type': 'ImageDecoder',
|
|
139
|
+
'tf_inputs': {
|
|
140
|
+
'encoded_stream': input_tensor,
|
|
141
|
+
'pixel_format': pixel_format,
|
|
142
|
+
},
|
|
143
|
+
'tf_outputs': {
|
|
144
|
+
'output': tf_layers_dict[graph_node_output.name]['tf_node'],
|
|
145
|
+
},
|
|
146
|
+
}
|
|
147
|
+
)
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import random
|
|
3
|
+
random.seed(0)
|
|
4
|
+
import numpy as np
|
|
5
|
+
np.random.seed(0)
|
|
6
|
+
import tensorflow as tf
|
|
7
|
+
import onnx_graphsurgeon as gs
|
|
8
|
+
from onnx2tf.utils.common_functions import (
|
|
9
|
+
get_constant_or_variable,
|
|
10
|
+
convert_axis,
|
|
11
|
+
print_node_info,
|
|
12
|
+
inverted_operation_enable_disable,
|
|
13
|
+
make_tf_node_info,
|
|
14
|
+
get_replacement_parameter,
|
|
15
|
+
pre_process_transpose,
|
|
16
|
+
post_process_transpose,
|
|
17
|
+
)
|
|
18
|
+
from onnx2tf.utils.enums import NUMPY_DTYPES_TO_TF_DTYPES
|
|
19
|
+
from onnx2tf.utils.logging import *
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _as_tensor(value):
|
|
23
|
+
if isinstance(value, np.ndarray):
|
|
24
|
+
return tf.convert_to_tensor(value)
|
|
25
|
+
if isinstance(value, (np.generic, int, float, bool, str, bytes)):
|
|
26
|
+
return tf.convert_to_tensor(value)
|
|
27
|
+
return value
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _move_class_to_last(tensor, class_axis):
|
|
31
|
+
rank = tensor.shape.rank
|
|
32
|
+
if rank is None:
|
|
33
|
+
rank = tf.rank(tensor)
|
|
34
|
+
if isinstance(rank, int):
|
|
35
|
+
if class_axis == rank - 1:
|
|
36
|
+
return tensor, None
|
|
37
|
+
perm = [i for i in range(rank) if i != class_axis] + [class_axis]
|
|
38
|
+
return tf.transpose(tensor, perm=perm), perm
|
|
39
|
+
return tensor, None
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@print_node_info
|
|
43
|
+
@inverted_operation_enable_disable
|
|
44
|
+
@get_replacement_parameter
|
|
45
|
+
def make_node(
|
|
46
|
+
*,
|
|
47
|
+
graph_node: gs.Node,
|
|
48
|
+
tf_layers_dict: dict,
|
|
49
|
+
**kwargs: dict,
|
|
50
|
+
):
|
|
51
|
+
"""NegativeLogLikelihoodLoss
|
|
52
|
+
|
|
53
|
+
Parameters
|
|
54
|
+
----------
|
|
55
|
+
graph_node: gs.Node
|
|
56
|
+
graph_surgeon Node
|
|
57
|
+
|
|
58
|
+
tf_layers_dict: dict
|
|
59
|
+
optype, shape, dtype, tensorflow graph
|
|
60
|
+
"""
|
|
61
|
+
before_op_output_shape_trans_1 = \
|
|
62
|
+
tf_layers_dict.get(graph_node.inputs[0].name, {}).get('before_op_output_shape_trans', True)
|
|
63
|
+
before_op_output_shape_trans_2 = \
|
|
64
|
+
tf_layers_dict.get(graph_node.inputs[1].name, {}).get('before_op_output_shape_trans', True)
|
|
65
|
+
before_op_output_shape_trans = \
|
|
66
|
+
before_op_output_shape_trans_1 \
|
|
67
|
+
and before_op_output_shape_trans_2
|
|
68
|
+
if len(graph_node.inputs) >= 3:
|
|
69
|
+
before_op_output_shape_trans_3 = \
|
|
70
|
+
tf_layers_dict.get(graph_node.inputs[2].name, {}).get('before_op_output_shape_trans', True)
|
|
71
|
+
before_op_output_shape_trans = \
|
|
72
|
+
before_op_output_shape_trans \
|
|
73
|
+
and before_op_output_shape_trans_3
|
|
74
|
+
|
|
75
|
+
graph_node_input_1 = get_constant_or_variable(
|
|
76
|
+
graph_node.inputs[0],
|
|
77
|
+
before_op_output_shape_trans,
|
|
78
|
+
)
|
|
79
|
+
graph_node_input_2 = get_constant_or_variable(
|
|
80
|
+
graph_node.inputs[1],
|
|
81
|
+
before_op_output_shape_trans,
|
|
82
|
+
)
|
|
83
|
+
graph_node_input_3 = None
|
|
84
|
+
if len(graph_node.inputs) >= 3:
|
|
85
|
+
graph_node_input_3 = get_constant_or_variable(
|
|
86
|
+
graph_node.inputs[2],
|
|
87
|
+
before_op_output_shape_trans,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
graph_node_output: gs.Variable = graph_node.outputs[0]
|
|
91
|
+
shape = graph_node_output.shape
|
|
92
|
+
dtype = graph_node_output.dtype
|
|
93
|
+
output_tf_dtype = NUMPY_DTYPES_TO_TF_DTYPES[dtype] \
|
|
94
|
+
if isinstance(dtype, np.dtype) else dtype
|
|
95
|
+
|
|
96
|
+
input_tensor = tf_layers_dict[graph_node_input_1.name]['tf_node'] \
|
|
97
|
+
if isinstance(graph_node_input_1, gs.Variable) else graph_node_input_1
|
|
98
|
+
target_tensor = tf_layers_dict[graph_node_input_2.name]['tf_node'] \
|
|
99
|
+
if isinstance(graph_node_input_2, gs.Variable) else graph_node_input_2
|
|
100
|
+
weight_tensor = None
|
|
101
|
+
if graph_node_input_3 is not None:
|
|
102
|
+
weight_tensor = tf_layers_dict[graph_node_input_3.name]['tf_node'] \
|
|
103
|
+
if isinstance(graph_node_input_3, gs.Variable) else graph_node_input_3
|
|
104
|
+
|
|
105
|
+
reduction = graph_node.attrs.get('reduction', 'mean')
|
|
106
|
+
ignore_index = graph_node.attrs.get('ignore_index', None)
|
|
107
|
+
|
|
108
|
+
input_rank = len(input_tensor.shape)
|
|
109
|
+
class_axis = convert_axis(
|
|
110
|
+
axis=1,
|
|
111
|
+
tensor_rank=input_rank,
|
|
112
|
+
before_op_output_shape_trans=before_op_output_shape_trans,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
# Preserving Graph Structure (Dict)
|
|
116
|
+
output_entry = {
|
|
117
|
+
'optype': graph_node.op,
|
|
118
|
+
'shape': shape,
|
|
119
|
+
'dtype': dtype,
|
|
120
|
+
}
|
|
121
|
+
if reduction == 'none':
|
|
122
|
+
output_entry['nhwc'] = tf_layers_dict[graph_node_input_1.name]['nhwc'] \
|
|
123
|
+
if isinstance(graph_node_input_1, gs.Variable) \
|
|
124
|
+
and 'nhwc' in tf_layers_dict[graph_node_input_1.name].keys() else False
|
|
125
|
+
tf_layers_dict[graph_node_output.name] = output_entry
|
|
126
|
+
|
|
127
|
+
# Pre-process transpose
|
|
128
|
+
input_tensor = pre_process_transpose(
|
|
129
|
+
value_before_transpose=input_tensor,
|
|
130
|
+
param_target='inputs',
|
|
131
|
+
param_name=graph_node.inputs[0].name,
|
|
132
|
+
**kwargs,
|
|
133
|
+
)
|
|
134
|
+
target_tensor = pre_process_transpose(
|
|
135
|
+
value_before_transpose=target_tensor,
|
|
136
|
+
param_target='inputs',
|
|
137
|
+
param_name=graph_node.inputs[1].name,
|
|
138
|
+
**kwargs,
|
|
139
|
+
)
|
|
140
|
+
if weight_tensor is not None:
|
|
141
|
+
weight_tensor = pre_process_transpose(
|
|
142
|
+
value_before_transpose=weight_tensor,
|
|
143
|
+
param_target='inputs',
|
|
144
|
+
param_name=graph_node.inputs[2].name,
|
|
145
|
+
**kwargs,
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
# Generation of TF OP
|
|
149
|
+
input_tensor = _as_tensor(input_tensor)
|
|
150
|
+
target_tensor = _as_tensor(target_tensor)
|
|
151
|
+
if weight_tensor is not None:
|
|
152
|
+
weight_tensor = _as_tensor(weight_tensor)
|
|
153
|
+
|
|
154
|
+
log_prob = input_tensor
|
|
155
|
+
log_prob, _ = _move_class_to_last(log_prob, class_axis)
|
|
156
|
+
|
|
157
|
+
depth = log_prob.shape[-1]
|
|
158
|
+
if depth is None:
|
|
159
|
+
depth = tf.shape(log_prob)[-1]
|
|
160
|
+
depth = tf.cast(depth, tf.int32)
|
|
161
|
+
|
|
162
|
+
labels = tf.cast(target_tensor, tf.int32)
|
|
163
|
+
if ignore_index is not None:
|
|
164
|
+
ignore_index_val = tf.cast(ignore_index, labels.dtype)
|
|
165
|
+
mask = tf.equal(labels, ignore_index_val)
|
|
166
|
+
labels_safe = tf.where(mask, tf.zeros_like(labels), labels)
|
|
167
|
+
else:
|
|
168
|
+
mask = None
|
|
169
|
+
labels_safe = labels
|
|
170
|
+
|
|
171
|
+
one_hot = tf.one_hot(
|
|
172
|
+
indices=labels_safe,
|
|
173
|
+
depth=depth,
|
|
174
|
+
axis=-1,
|
|
175
|
+
dtype=log_prob.dtype,
|
|
176
|
+
)
|
|
177
|
+
selected = tf.reduce_sum(log_prob * one_hot, axis=-1)
|
|
178
|
+
loss = -selected
|
|
179
|
+
|
|
180
|
+
weight_per_label = None
|
|
181
|
+
if weight_tensor is not None:
|
|
182
|
+
weight_per_label = tf.gather(weight_tensor, labels_safe)
|
|
183
|
+
weight_per_label = tf.cast(weight_per_label, loss.dtype)
|
|
184
|
+
if mask is not None:
|
|
185
|
+
weight_per_label = tf.where(mask, tf.zeros_like(weight_per_label), weight_per_label)
|
|
186
|
+
loss = loss * weight_per_label
|
|
187
|
+
|
|
188
|
+
if mask is not None:
|
|
189
|
+
loss = tf.where(mask, tf.zeros_like(loss), loss)
|
|
190
|
+
|
|
191
|
+
if reduction == 'none':
|
|
192
|
+
output_tensor = loss
|
|
193
|
+
elif reduction == 'sum':
|
|
194
|
+
output_tensor = tf.reduce_sum(loss)
|
|
195
|
+
elif reduction == 'mean':
|
|
196
|
+
if weight_per_label is None:
|
|
197
|
+
output_tensor = tf.reduce_mean(loss)
|
|
198
|
+
else:
|
|
199
|
+
denom = tf.reduce_sum(weight_per_label)
|
|
200
|
+
output_tensor = tf.math.divide_no_nan(tf.reduce_sum(loss), denom)
|
|
201
|
+
else:
|
|
202
|
+
error(
|
|
203
|
+
f'NegativeLogLikelihoodLoss reduction={reduction} is not supported.\n' +
|
|
204
|
+
f'graph_node.name: {graph_node.name}'
|
|
205
|
+
)
|
|
206
|
+
sys.exit(1)
|
|
207
|
+
|
|
208
|
+
if output_tf_dtype is not None and output_tensor.dtype != output_tf_dtype:
|
|
209
|
+
output_tensor = tf.cast(output_tensor, output_tf_dtype)
|
|
210
|
+
|
|
211
|
+
tf_layers_dict[graph_node_output.name]['tf_node'] = output_tensor
|
|
212
|
+
|
|
213
|
+
# Post-process transpose
|
|
214
|
+
tf_layers_dict[graph_node_output.name]['tf_node'] = post_process_transpose(
|
|
215
|
+
value_before_transpose=tf_layers_dict[graph_node_output.name]['tf_node'],
|
|
216
|
+
param_target='outputs',
|
|
217
|
+
param_name=graph_node.outputs[0].name,
|
|
218
|
+
**kwargs,
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
# Generation of Debug Info
|
|
222
|
+
tf_layers_dict[graph_node_output.name]['tf_node_info'] = \
|
|
223
|
+
make_tf_node_info(
|
|
224
|
+
node_info={
|
|
225
|
+
'tf_op_type': 'NegativeLogLikelihoodLoss',
|
|
226
|
+
'tf_inputs': {
|
|
227
|
+
'input': input_tensor,
|
|
228
|
+
'target': target_tensor,
|
|
229
|
+
'weight': weight_tensor,
|
|
230
|
+
'reduction': reduction,
|
|
231
|
+
'ignore_index': ignore_index,
|
|
232
|
+
},
|
|
233
|
+
'tf_outputs': {
|
|
234
|
+
'output': tf_layers_dict[graph_node_output.name]['tf_node'],
|
|
235
|
+
},
|
|
236
|
+
}
|
|
237
|
+
)
|