count_parameters: Count the Number of Trainable Parameters in an MLP...

View source: R/mlp_engine.R

count_parametersR Documentation

Count the Number of Trainable Parameters in an MLP Architecture

Description

Computes the total number of weights and bias terms required by a multilayer perceptron architecture.

Usage

count_parameters(architecture, input_dim = NULL)

Arguments

architecture

An object created by mlp_architecture().

input_dim

Optional positive integer specifying the number of input features. If NULL, architecture$input_dim is used.

Value

A positive integer giving the total number of parameters.

Examples

arch <- mlp_architecture(
  input_dim = 4,
  layers = list(
    dense_layer(5, activation = "relu"),
    dense_layer(1, activation = "linear")
  )
)
count_parameters(arch)

metANN documentation built on May 16, 2026, 1:06 a.m.