Regularizers in tensorflow/tfjs-node

I have the following message when trying to use regularizers in tensorflow/tfjs-node version 4.17 and 4.18: “Layer invocation in the presence of activity regularizer(s) is not supported yet.”
Does anyone know when Google will have regularizers in tensorflow/tfjs-node?
Thanks in advance

Hi @Aleftos ,

Sorry for late in my response. I have checked with @tensorflow/tfjs-node@4.22 and it is adding the regularizers to the layers in the model with the specified regularizers.

Example:

const tf = require('@tensorflow/tfjs-node');
const model = tf.sequential();
model.add(tf.layers.dense({
    units: 64,
    inputShape: [784]
  }));

model.add(tf.layers.dense({
  units: 64,
  activation: 'relu',
  kernelRegularizer:  tf.regularizers.l1l2({l1: 0.01, l2: 0.01}), // Apply L2 regularization
}));

model.compile({
  optimizer: 'adam',
  loss: 'categoricalCrossentropy',
});

console.log(model.summary())

Output:

__________________________________________________________________________________________
Layer (type)                Input Shape               Output shape              Param #   
==========================================================================================
dense_Dense1 (Dense)        [[null,784]]              [null,64]                 50240     
__________________________________________________________________________________________
dense_Dense2 (Dense)        [[null,64]]               [null,64]                 4160      
==========================================================================================
Total params: 54400
Trainable params: 54400
Non-trainable params: 0
__________________________________________________________________________________________

Let me know if the same is working for you as well. Thank You !!