anchor.diff:                  // calculate Jacobians w.r.t. all variables
                   value.Expr |> computeWithRootJacobian incomingJacobian)    
               |> Seq.reduce merge
  -
   
           // go through portContents and create actual port contents
           let ports =
  
positive.code:                 port, {Expr=expr; SliceDim=sliceDim})
              |> Map.ofSeq
  
  
          // create variable specification
          let varsFromDeriv = 
              varInputSpecs
              |> Seq.map (fun vis -> vis.Key, vis.Value)
              |> Map.ofSeq
  
          // need to map original vars
          // 1. ConstArg stays as is
          // 2. SequenceArgSlice gets remapped to reversed SequeceArgSlice
          // 3. PreviousPort gets remapped to output sequence of original op with appropriate delay and reversed
          // 4. IterationIndex gets remapped to IterationsRemaining
          // 5. IterationsRemaining gets remapped to IterationIndex
  
          let originalVars =
              spec.Vars
              |> Map.map (fun vs li ->
                  match li with
                  | ConstArg _ -> li
                  | SequenceArgSlice {ArgIdx=argIdx; SliceDim=sliceDim} ->
                      let revExpr = Expr.reverseAxis sliceDim args.[argIdx]
                      SequenceArgSlice {ArgIdx=addArg revExpr; SliceDim=sliceDim}
                  | PreviousChannel pp ->
                      let portOutput = Expr.loop spec pp.Channel originalArgs
                      let portExpr = spec.Channels.[pp.Channel].Expr
                      let sliceDim = spec.Channels.[pp.Channel].SliceDim
  
negative.code:                 dExpr0.Shape.[0]
              | [] -> failwith "output derivatives invalid"
  
          /// argument of the derivative loop expression
          let args = ResizeArray<ExprT> originalArgs
  
  