Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel 'Conv2DBackpropFilter' not registered for backend 'wasm' #8474

Open
bjqsyq opened this issue Dec 11, 2024 · 1 comment
Open

Kernel 'Conv2DBackpropFilter' not registered for backend 'wasm' #8474

bjqsyq opened this issue Dec 11, 2024 · 1 comment
Assignees
Labels

Comments

@bjqsyq
Copy link

bjqsyq commented Dec 11, 2024

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): I wrote custom code
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):Windows 11 专业版
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device:
  • TensorFlow.js installed from (npm or script link): npm
  • TensorFlow.js version (use command below): @tensorflow/[email protected], @tensorflow/[email protected]
  • Browser version:
  • Tensorflow.js Converter Version:@tensorflow/[email protected]

Describe the current behavior
tf.layers.conv2d are used in the model,Set the tf.setBackend('wasm'),Errors are reported during training:Error: Kernel 'Conv2DBackpropFilter' not registered for backend 'wasm'
Describe the expected behavior
No errors
Standalone code to reproduce the issue

import * as tf from '@tensorflow/tfjs-node';
import '@tensorflow/tfjs-backend-wasm';
createModel(){
const model = tf.sequential();
model.add(
tf.layers.conv2d({
inputShape: [130,6,1],
kernelSize: 3,
filters: 6,
strides: 1,
activation: 'relu',
kernelInitializer: 'varianceScaling',
}),
);
model.add(tf.layers.maxPooling2d({ poolSize: [2, 2], strides: [2, 2] }));
model.add(
tf.layers.conv2d({
kernelSize: 1,
filters: 2,
strides: 1,
activation: 'relu',
kernelInitializer: 'varianceScaling',
}),
);
model.add(tf.layers.maxPooling2d({ poolSize: [2, 2], strides: [2, 2] }));
model.add(tf.layers.flatten());
model.add(
tf.layers.dense({
units: 60,
kernelRegularizer: tf.regularizers.l2({ l2: 0.001 }),
kernelInitializer: 'varianceScaling',
activation: 'relu',
}),
);
model.add(
tf.layers.dense({
units:21,
kernelInitializer: 'varianceScaling',
activation: 'softmax',
}),
);
const optimizer = tf.train.adam();
model.compile({
optimizer: optimizer,
loss: 'categoricalCrossentropy',
metrics: ['accuracy'],
});
return model;
}
async modelFit(model,asyncData
): {
this.setFitState(true);
const data = tf.data
.generator(asyncData)
.shuffle(512)
.batch(512);

await model
.fitDataset(data, {
epochs: 10,
callbacks: {
onTrainBegin: async (logs) => {
this.batchTmie = Date.now();
},
onBatchEnd: (batch, logs)=>{
console.log(batch = ${batch},times=${Date.now())
},
onEpochEnd: async (epoch, logs)=>{
console.log(Epoch ${epoch}:loss = ${logs.loss});
},
},
})
.then(async () => {
await this.saveModel();
})
.catch((e) => {
console.error(e
});
}
const model=createModel()
modelFit(model, data);

Provide a reproducible test case that is the bare minimum necessary to generate
the problem. If possible, please share a link to Colab/CodePen/any notebook.

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.

@bjqsyq bjqsyq added the type:bug Something isn't working label Dec 11, 2024
@shmishra99 shmishra99 self-assigned this Dec 11, 2024
@shmishra99
Copy link
Contributor

Hi @bjqsyq ,

We appreciate your effort in highlighting this issue. Conv2DBackpropFilter isn't yet supported in the WASM backend. We've logged this as a feature request. Consider using CPU, WebGL, or WebGPU backends for now. i will provide updates on WASM backend support.

Thank You!!

@shmishra99 shmishra99 added type:feature New feature or request stat:awaiting tensorflower and removed type:bug Something isn't working labels Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants