Hello. This doubt may seem a little bit less researched, but here I go. I wanted to convert the stylegan generator to tensorflow js model. But this I understand that stylegan python (using TF2.x) has custom loops and objects in the generator object. I followed the steps mentioned below :
@lina128 Thank you . I converted the model to shard files and model.json. Then I loaded the graph model.
When I tried to run the following code to generate the image, it throws an error . const noise = tf.randomNormal().expandDims(0); let generatedImage = await generator.executeAsync(noise)
The error is that: util_base.ts:154 Uncaught (in promise) Error: Error in depthwiseConv2d: number of input channels (8) must match the inChannels dimension in filter 512.
at Object.assert (util_base.ts:154)
at depthwiseConv2d_ (depthwise_conv2d.ts:99)
at Object.depthwiseConv2d__op (operation.ts:51)
at Object.executeOp (convolution_executor.ts:195)
at Engine.scopedRun (engine.ts:478)
at Engine.tidy (engine.ts:465)
at Object.tidy (globals.ts:192)
I am guessing it is because of the fact that depthwise convolution in tensorflow doesn’t support ‘BCHW’ format as mentioned in the API reference. But in the actual python code the data_format specified in the depthwise convolution was ‘BCHW’. Can anyone suggest what could be the error ?