op_assign: Assign

Description Usage Arguments Details

Description

Assign the value in input to ref and return the new value, ref need to be the same layout as input. Both ref and input can’t have dynamic axis and broadcast isn’t supported for the assign operator. During forward pass, ref will get the new value after the forward or backward pass finish, so that any part of the graph that depend on ref will get the old value. To get the new value, use the one returned by the assign node. The reason for that is to make assign have a deterministic behavior.

Usage

1
op_assign(ref, input, name = "")

Arguments

name

(str) the name of the Function instance in the network

Details

If not computing gradients, the ref will be assigned the new value after the forward pass over the entire Function graph is complete; i.e. all uses of ref in the forward pass will use the original (pre-assignment) value of ref.

If computing gradients (training mode), the assignment to ref will happen after completing both the forward and backward passes over the entire Function graph.

The ref must be a Parameter or Constant. If the same ref is used in multiple assign operations, then the order in which the assignment happens is non-deterministic and the final value can be either of the assignments unless an order is established using a data dependence between the assignments.


Microsoft/CNTK-R documentation built on May 28, 2019, 1:52 p.m.