Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

layer_variable

Variable Layer


Description

Simply returns a (trainable) variable, regardless of input. This layer implements the mathematical function f(x) = c where c is a constant, i.e., unchanged for all x. Like other Keras layers, the constant is trainable. This layer can also be interpretted as the special case of layer_dense() when the kernel is forced to be the zero matrix (tf$zeros).

Usage

layer_variable(
  object,
  shape,
  dtype = NULL,
  activation = NULL,
  initializer = "zeros",
  regularizer = NULL,
  constraint = NULL,
  ...
)

Arguments

object

Model or layer object

shape

integer or integer vector specifying the shape of the output of this layer.

dtype

TensorFlow dtype of the variable created by this layer.

activation

An activation function. See keras::layer_dense. Default: NULL.

initializer

Initializer for the constant vector.

regularizer

Regularizer function applied to the constant vector.

constraint

Constraint function applied to the constant vector.

...

Additional keyword arguments passed to the keras::layer_dense constructed by this layer.

Value

a Keras layer

See Also


tfprobability

Interface to 'TensorFlow Probability'

v0.11.0.0
Apache License (>= 2.0)
Authors
Sigrid Keydana [aut, cre], Daniel Falbel [ctb], Kevin Kuo [ctb] (<https://orcid.org/0000-0001-7803-7901>), RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.