Skip to content

depthMultiplier not saved for separableConv2d #6083

@ersimont

Description

@ersimont

Please make sure that this is a bug. As per our
GitHub Policy,
we only address code/doc bugs, performance issues, feature requests and
build/installation issues on GitHub. tag:bug_template

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js): yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: n/a
  • TensorFlow.js installed from (npm or script link): yarn add @tensorflow/tfjs-node
  • TensorFlow.js version (use command below): 3.13.0
  • Browser version: n/a
  • Tensorflow.js Converter Version: n/a

Describe the current behavior

When saving a model I created that includes tf.layers.separableConv2d, it does not include the depthMultilpier in the resulting model.json. This causes an error when trying to load the file, e.g.:

Error: Shape mismatch: [5,5,3,1] vs. [5,5,3,6]

If I manually update model.json to have "depthMultiplier": 6 (in this example), the models loads and behaves correctly.

Describe the expected behavior

Models that are saved can also be loaded.

Standalone code to reproduce the issue

const model = tf.sequential();
model.add(
  tf.layers.separableConv2d({
    inputShape: [96, 96, 3],
    filters: 9,
    kernelSize: 5,
    depthMultiplier: 6,
  }),
);
await model.save('file://bad-model');
await tf.loadLayersModel('file://bad-model/model.json');

Other info / logs Include any logs or source code that would be helpful to
diagnose the problem. If including tracebacks, please include the full
traceback. Large logs and files should be attached.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions