question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unknown padding parameter: explicit

See original GitHub issue

TensorFlow.js version

Tested with both: 1.7.4 & 2.0.0-rc.4

Browser version

Any.

Describe the problem or feature request

The model.json converted using tensorflowjs_converter 1.7.4r1 contained explicit_paddings in the following lines:

...
      {
        "name": "StatefulPartitionedCall/sequential/conv2d/Relu",
        "op": "_FusedConv2D",
        "input": [
          "conv2d_input",
          "Func/StatefulPartitionedCall/input/_2",
          "Func/StatefulPartitionedCall/input/_3"
        ],
        "device": "/device:CPU:0",
        "attr": {
          "dilations": { "list": { "i": ["1", "1", "1", "1"] } },
          "T": { "type": "DT_FLOAT" },
          "strides": { "list": { "i": ["1", "1", "1", "1"] } },
          "data_format": { "s": "TkhXQw==" },
          "use_cudnn_on_gpu": { "b": true },
          "explicit_paddings": {
            "list": { "i": ["0", "0", "0", "0", "0", "0", "0", "0"] }
          },
          "num_args": { "i": "1" },
          "epsilon": { "f": 0.0 },
          "padding": { "s": "RVhQTElDSVQ=" },
          "fused_ops": { "list": { "s": ["Qmlhc0FkZA==", "UmVsdQ=="] } }
        }
      },
...

I get this when trying to use the model. (2.0.0-rc.4)

    Unknown padding parameter: explicit

      at getPadAndOutInfo (node_modules/@tensorflow/tfjs-core/src/ops/conv_util.ts:434:11)
      at conv_util.computeConv2DInfo (node_modules/@tensorflow/tfjs-core/src/ops/conv_util.ts:149:9)
      at fusedConv2d_ (node_modules/@tensorflow/tfjs-core/src/ops/fused_ops.ts:387:20)
      at fusedConv2d (node_modules/@tensorflow/tfjs-core/src/ops/operation.ts:45:24)
      at convolution.executeOp (node_modules/@tensorflow/tfjs-converter/src/operations/executors/convolution_executor.ts:102:15)
      at node_modules/@tensorflow/tfjs-converter/src/operations/operation_executor.ts:64:23
      at node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/src/engine.ts:425:20
      at Engine.scopedRun (node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/src/engine.ts:436:19)
      at Engine.tidy (node_modules/@tensorflow/tfjs/node_modules/@tensorflow/tfjs-core/src/engine.ts:423:17)
      at Object.tidy (node_modules/@tensorflow/tfjs-core/src/globals.ts:182:17)

Pseudo-code of what I did. The other models without explicit_paddings on the converted json did work without issues.

  const model = await loadGraphModel(
    'http://localhost:5000/model2a/model.json'
  );
  const dTensor = tensor([...d, ...d]);
  const reshape = dTensor.reshape([2, 18, 4, 1]);
  console.log(reshape.shape);
  const prediction = model.predict(reshape);

Code to reproduce the bug / link to feature request

Unfortunately, I can’t share the code at the moment. But Also I have other models that work without problems using the same pattern of approach. What common for those that worked is that they do not have explicit_paddings in their generated model.json.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
pyu10055commented, Jun 3, 2020

@bangonkali Thank you, we will add explicit padding support for all conv2d ops.

0reactions
pyu10055commented, Jun 3, 2020

I think so, the batch and channel padding are zeros anyway.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RFC 4820 - Padding Chunk and Parameter for the Stream ...
Abstract This document defines a padding chunk and a padding parameter and describes the required receiver side procedures.
Read more >
Content padding parameter it is not used - Stack Overflow
Since Compose 1.2.0 it's required to use padding parameter, passed into Scaffold content composable. You should apply it to the topmost ...
Read more >
Documentation - Narrowing - TypeScript
In other words, we haven't explicitly checked if padding is a number first, nor are we handling the case where it's a string...
Read more >
nltk.lm package - NLTK
Note the n argument, that tells the function we need padding for bigrams. ... not seen during training are mapped to the vocabulary's...
Read more >
Diagnostic flags in Clang — Clang 16.0.0git documentation
Some of the diagnostics controlled by this flag are enabled by default. Diagnostic text: warning: A attribute parameter B is negative and will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found