transpose operation is removed during conversion with tensorflowjs_converter
TensorFlow.js version
tfjs-converter v0.1.2
transpose operation ( between two reshape operations for image scaling ) is missing occasionally
Hi, can you share more details? Are you converting a SavedModel or a Keras model and can you share code to help us reproduce the issue? Thanks!
Hi @chenjin3, can you take a look at issue #85, see if the issue can be solved with the similar approach. It would be very much appreciated if you can ltry it out and let us know, so we could disable the offending grappler optimizers in the short term until it is fixed.
@dsmilkov I'm converting a SavedModel to Web-friendly format. You can get My SavedModel from this repo. In the debug directory, I print FrozenModel.executor.weightMap to webModel.log file. You can see SR_TV/pixel_s_2/transpose/perm Node, but no SR_TV/pixel_s_1/transpose/perm Node (SR_TV/pixel_s_2 & SR_TV/pixel_s_1 are same operations all include transpose).
@dsmilkov For supporting resizeBilinear operation, I add following code to src/operations/executors/convolution_executor.js
case 'resizeBilinear': {
const alignCorners = getParamValue('alignCorners', node, tensorMap) as boolean;
const size = getParamValue('size', node, tensorMap) as number[];
return [tfc.image.resizeBilinear(
getParamValue('images', node, tensorMap) as tfc.Tensor3D | tfc.Tensor4D,
[size[0], size[1]],
alignCorners)];
}
and
diff --git a/src/operations/executors/convolution_executor.ts b/src/operations/executors/convolution_executor.ts
index cc1950d..cf54c88 100644
--- a/src/operations/executors/convolution_executor.ts
+++ b/src/operations/executors/convolution_executor.ts
@@ -107,7 +107,7 @@ export let executeOp: OpExecutor = (node: Node, tensorMap: NamedTensorsMap):
const size = getParamValue('size', node, tensorMap) as number[];
return [tfc.image.resizeBilinear(
- getParamValue('image', node, tensorMap) as tfc.Tensor3D | tfc.Tensor4D,
+ getParamValue('images', node, tensorMap) as tfc.Tensor3D | tfc.Tensor4D,
[size[0], size[1]],
alignCorners)];
}
@pyu10055 Do you mean trying change the code in matrices_executor.ts like #85 ?
@chenjin3 is this fixed by your PR to converter?
@pyu10055 Not work. 😕
@chenjin3 can you confirm this issue with the latest converter? closing this issue for now, please feel free to reopen if it still does not work. thanks.