Tensorflow.js tf.layers getConfig() Method
Last Updated :
22 Apr, 2022
Tensorflow.js is an open-source library developed by Google for running machine learning models and deep learning neural networks in the browser or node environment.
The tf.layers getConfig() function is used to get the configuration of a layer.
Syntax:
getConfig()
Parameters: This function does not accept any parameters.
Return Value: This function returns the configuration of the layer.
Example 1: We will get the configuration of the minimum layer in this example.
Javascript
const tf = require( "@tensorflow/tfjs" )
const minLayer = tf.layers.minimum();
const config = minLayer.getConfig();
console.log(config)
|
Output:
{ name: 'minimum_Minimum1', trainable: true }
Example 2: We will get the configuration of the dense layer in this example.
Javascript
const tf = require( "@tensorflow/tfjs" )
const denseLayer = tf.layers.dense({units: 1});
const config = denseLayer.getConfig();
console.log(config)
|
Output:
{ units: 1,
activation: 'linear',
useBias: true,
kernelInitializer:
{ className: 'VarianceScaling',
config:
{ scale: 1, mode: 'fanAvg',
distribution: 'normal', seed: null } },
biasInitializer: { className: 'Zeros', config: {} },
kernelRegularizer: null,
biasRegularizer: null,
activityRegularizer: null,
kernelConstraint: null,
biasConstraint: null,
name: 'dense_Dense1',
trainable: true }
Example 3: We will get the configuration of the application layer in this example.
Javascript
const tf = require( "@tensorflow/tfjs" )
const activationLayer =
tf.layers.activation({activation: 'relu6' });
const config = activationLayer.getConfig();
console.log(config)
|
Output:
{ activation: 'relu6',
name: 'activation_Activation1',
trainable: true }
Reference: https://js.tensorflow.org/api/latest/#tf.layers.Layer.getConfig
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...