public ConstantVector(ConstantVector other) : this(CNTKLibPINVOKE.new_ConstantVector__SWIG_1(ConstantVector.getCPtr(other)), true) { if (CNTKLibPINVOKE.SWIGPendingException.Pending) { throw CNTKLibPINVOKE.SWIGPendingException.Retrieve(); } }
public ConstantVectorEnumerator(ConstantVector collection) { collectionRef = collection; currentIndex = -1; currentObject = null; currentSize = collectionRef.Count; }
public void SetRange(int index, ConstantVector values) { CNTKLibPINVOKE.ConstantVector_SetRange(swigCPtr, index, ConstantVector.getCPtr(values)); if (CNTKLibPINVOKE.SWIGPendingException.Pending) { throw CNTKLibPINVOKE.SWIGPendingException.Retrieve(); } }
public ConstantVector Constants() { ConstantVector ret = new ConstantVector(CNTKLibPINVOKE.Function_Constants(swigCPtr), true); if (CNTKLibPINVOKE.SWIGPendingException.Pending) { throw CNTKLibPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static ConstantVector Repeat(Constant value, int count) { global::System.IntPtr cPtr = CNTKLibPINVOKE.ConstantVector_Repeat(Constant.getCPtr(value), count); ConstantVector ret = (cPtr == global::System.IntPtr.Zero) ? null : new ConstantVector(cPtr, true); if (CNTKLibPINVOKE.SWIGPendingException.Pending) { throw CNTKLibPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public ConstantVector GetRange(int index, int count) { global::System.IntPtr cPtr = CNTKLibPINVOKE.ConstantVector_GetRange(swigCPtr, index, count); ConstantVector ret = (cPtr == global::System.IntPtr.Zero) ? null : new ConstantVector(cPtr, true); if (CNTKLibPINVOKE.SWIGPendingException.Pending) { throw CNTKLibPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
/// <summary> /// Given a transition and the residual weight of its source state, adds weighted non-zero probability character segments /// associated with the transition to the list. /// </summary> /// <param name="transition">The transition.</param> /// <param name="sourceStateResidualWeight">The logarithm of the residual weight of the source state of the transition.</param> /// <param name="bounds">The list for storing numbered segment bounds.</param> private static void AddTransitionCharSegmentBounds( Transition transition, Weight sourceStateResidualWeight, List <Tuple <int, TransitionCharSegmentBound> > bounds) { var probs = (PiecewiseVector)transition.ElementDistribution.GetProbs(); int commonValueStart = char.MinValue; Weight commonValue = Weight.FromValue(probs.CommonValue); Weight weightBase = Weight.Product(transition.Weight, sourceStateResidualWeight); TransitionCharSegmentBound newSegmentBound; ////if (double.IsInfinity(weightBase.Value)) ////{ //// Console.WriteLine("Weight base infinity"); ////} for (int i = 0; i < probs.Pieces.Count; ++i) { ConstantVector piece = probs.Pieces[i]; if (piece.Start > commonValueStart && !commonValue.IsZero) { // Add endpoints for the common value Weight segmentWeight = Weight.Product(commonValue, weightBase); newSegmentBound = new TransitionCharSegmentBound(commonValueStart, transition.DestinationStateIndex, segmentWeight, true); bounds.Add(new Tuple <int, TransitionCharSegmentBound>(bounds.Count, newSegmentBound)); newSegmentBound = new TransitionCharSegmentBound(piece.Start, transition.DestinationStateIndex, segmentWeight, false); bounds.Add(new Tuple <int, TransitionCharSegmentBound>(bounds.Count, newSegmentBound)); } // Add segment endpoints Weight pieceValue = Weight.FromValue(piece.Value); if (!pieceValue.IsZero) { Weight segmentWeight = Weight.Product(pieceValue, weightBase); newSegmentBound = new TransitionCharSegmentBound(piece.Start, transition.DestinationStateIndex, segmentWeight, true); bounds.Add(new Tuple <int, TransitionCharSegmentBound>(bounds.Count, newSegmentBound)); newSegmentBound = new TransitionCharSegmentBound(piece.End + 1, transition.DestinationStateIndex, segmentWeight, false); bounds.Add(new Tuple <int, TransitionCharSegmentBound>(bounds.Count, newSegmentBound)); } commonValueStart = piece.End + 1; } if (!commonValue.IsZero && (probs.Pieces.Count == 0 || probs.Pieces[probs.Pieces.Count - 1].End != char.MaxValue)) { // Add endpoints for the last common value segment Weight segmentWeight = Weight.Product(commonValue, weightBase); newSegmentBound = new TransitionCharSegmentBound(commonValueStart, transition.DestinationStateIndex, segmentWeight, true); bounds.Add(new Tuple <int, TransitionCharSegmentBound>(bounds.Count, newSegmentBound)); newSegmentBound = new TransitionCharSegmentBound(char.MaxValue + 1, transition.DestinationStateIndex, segmentWeight, false); bounds.Add(new Tuple <int, TransitionCharSegmentBound>(bounds.Count, newSegmentBound)); } }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ConstantVector obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }