// Additionally defined public WrappedFunction Clone(ParameterCloningMethod parameterCloningMethod, Hashtable replacements) { var converter = new Func <object, Variable>(x => { if (x is PSObject) { x = (x as PSObject).BaseObject; } if (x is Variable) { return(x as Variable); } if (x is WrappedVariable) { return(x as WrappedVariable); } if (x is Function) { return(x as Function); } if (x is WrappedFunction) { return(x as WrappedFunction); } throw new ArgumentException("Can't convert to Variable"); }); var rep = Converter.HashtableToDictionary <Variable, Variable>(replacements, converter, converter); return(_f.Clone(parameterCloningMethod, rep)); }
public Function CloneFlattened(ParameterCloningMethod parameterCloneMethod) { global::System.IntPtr cPtr = CNTKLibPINVOKE.Function_CloneFlattened__SWIG_0(swigCPtr, (int)parameterCloneMethod); Function ret = (cPtr == global::System.IntPtr.Zero) ? null : new Function(cPtr, true); if (CNTKLibPINVOKE.SWIGPendingException.Pending) { throw CNTKLibPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
private Function _Clone(ParameterCloningMethod parameterCloneMethod, UnorderedMapVariableVariable replacements) { global::System.IntPtr cPtr = CNTKLibPINVOKE.Function__Clone__SWIG_1(swigCPtr, (int)parameterCloneMethod, UnorderedMapVariableVariable.getCPtr(replacements)); Function ret = (cPtr == global::System.IntPtr.Zero) ? null : new Function(cPtr, true); if (CNTKLibPINVOKE.SWIGPendingException.Pending) { throw CNTKLibPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
/// <summary> /// Clones 'this' Function. The parameters of the Function are either cloned, shared or frozen as specified by the parameterCloneMethod argument and /// any variable replacements requested are applied in the cloned Function instance. /// </summary> /// <param name="parameterCloneMethod"></param> /// <param name="replacements">existing variables to be replaced with new variables.</param> /// <returns></returns> public Function Clone(ParameterCloningMethod parameterCloneMethod, IDictionary <Variable, Variable> replacements) { UnorderedMapVariableVariable replacementVector = Helper.AsUnorderedMapVariableVariable(replacements); return(_Clone(parameterCloneMethod, replacementVector)); }
/// <summary> /// Creates a new cloned function instance. For C# Eval, default ParameterCloningMethod is share. /// </summary> /// <param name="parameterCloneMethod"></param> /// <returns></returns> public Function Clone(ParameterCloningMethod parameterCloneMethod = ParameterCloningMethod.Share) { return(_Clone(ParameterCloningMethod.Share)); }
public WrappedFunction CloneFlattened(ParameterCloningMethod parameterCloningMethod) => _f.CloneFlattened(parameterCloningMethod);
public WrappedFunction Clone(ParameterCloningMethod parameterCloneMethod, IDictionary <Variable, Variable> replacements) => _f.Clone(parameterCloneMethod, replacements);
public WrappedFunction Clone(ParameterCloningMethod parameterCloningMethod = 0) => _f.Clone(parameterCloningMethod);