A tf.layers.LayerVariable is similar to a tf.Tensor in that it has a dtype and shape, but its value is mutable. The value is itself represented as atf.Tensor, and can be read with the read() method and updated with the write() method.

Constructors

Methods

Constructors

  • Construct Variable from a tf.Tensor.

    If not explicitly named, the Variable will be given a name with the prefix 'Variable'. Variable names are unique. In the case of name collision, suffixies '_' will be added to the name.

    Parameters

    • val: Tensor<Rank>

      Initial value of the Variable.

    • Optional dtype: keyof DataTypeMap
    • Optional name: string

      Name of the variable. If null or undefined is provided, it will default a name with the prefix 'Variable'.

    • Optional trainable: boolean
    • Optional constraint: Constraint

      Optional, projection function to be applied to the variable after optimize updates

    Returns LayerVariable

    Throws

    ValueError if name is null or undefined.

Methods

  • Dispose this LayersVariable instance from memory.

    Returns void

  • Get a snapshot of the Variable's value.

    The returned value is a snapshot of the Variable's value at the time of the invocation. Future mutations in the value of the tensor will only be reflected by future calls to this method.

    Returns Tensor<Rank>

  • Update the value of the Variable.

    Parameters

    Returns LayerVariable

    This Variable.

Generated using TypeDoc