Skip to contents

Only scalar values are allowed. The constant value provided must be convertible to the dtype requested when calling the initializer.

Usage

initializer_constant(value = 0)

Arguments

value

A numeric scalar.

Value

An Initializer instance that can be passed to layer or variable constructors, or called directly with a shape to return a Tensor.

Examples

# Standalone usage:
initializer <- initializer_constant(10)
values <- initializer(shape = c(2, 2))

# Usage in a Keras layer:
initializer <- initializer_constant(10)
layer <- layer_dense(units = 3, kernel_initializer = initializer)