Loading TOC...

cntk.pastValue

cntk.pastValue(
   $x as cntk.variable,
   $initial-state as cntk.variable,
   $offset as (Number|String),
   $name as String
) as cntk.function

Summary

This function returns the past value w.r.t. x. It is most often used when creating RNNs. The resulting tensor has the same shape as the input but is the previous logical sample. The time_step parameter is the number of steps to look into the past and is 1 by default. If there is no past value (i.e. the current sample is the first one in the tensor) then the initial_state value is returned. The initial state can be a constant (scalar or tensor), a learnable tensor or input data (which has a batch dimension, as needed for sequence-to-sequence models).

Parameters
$x The tensor (or its name) from which the past value is obtained.
$initial-state Tensor or scalar representing the initial value to be used when the input tensor is shifted in time.
$offset The number of time steps to look into the past (default 1).
$name The name of the function instance in the network.

Example

  var inputVariable1 = cntk.inputVariable(cntk.shape([3]), "float", fn.false(),
    fn.false(), "feature")
  var inputVariable2 = cntk.inputVariable(cntk.shape([3]), "float", fn.false(),
    fn.false(), "feature")
  cntk.pastValue(inputVariable1, inputVariable2, 1)
  => cntk.function(Composite PastValue (Input(Name(feature), Shape([3]),
  Dynamic Axes([Sequence Axis(Default Dynamic Axis), Batch Axis(Default Batch Axis)])), Input(Name(feature), Shape([3]), Dynamic Axes([Sequence Axis(Default Dynamic Axis), Batch Axis(Default Batch Axis)]))))

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.