unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc() { __Native * @ref = UnsafeUtilities.Alloc <__Native>(); @ref->InputGradientTensor = InputGradientTensor.__MarshalAlloc(); @ref->OutputGradientTensor = OutputGradientTensor.__MarshalAlloc(); var dimensionCount = InputWindowOffsets.Length; if (InputWindowSizes.Length != dimensionCount) { throw new IndexOutOfRangeException("InputWindowSizes must have the same length as InputWindowOffsets."); } if (InputWindowStrides.Length != dimensionCount) { throw new IndexOutOfRangeException("InputWindowStrides must have the same length as InputWindowOffsets."); } @ref->DimensionCount = dimensionCount; @ref->InputWindowOffsets = new(UnsafeUtilities.AllocWithData(InputWindowOffsets)); @ref->InputWindowSizes = new(UnsafeUtilities.AllocWithData(InputWindowSizes)); @ref->InputWindowStrides = new(UnsafeUtilities.AllocWithData(InputWindowStrides)); return(new(@ref)); }
unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc() { __Native * @ref = UnsafeUtilities.Alloc <__Native>(); @ref->InputGradientTensor = InputGradientTensor.__MarshalAlloc(); @ref->OutputGradientTensor = OutputGradientTensor.__MarshalAlloc(); var dimensionCount = Strides.Length; if (WindowSize.Length != dimensionCount) { throw new IndexOutOfRangeException("WindowSize must have the same length as Strides."); } if (StartPadding.Length != dimensionCount) { throw new IndexOutOfRangeException("StartPadding must have the same length as Strides."); } if (EndPadding.Length != dimensionCount) { throw new IndexOutOfRangeException("EndPadding must have the same length as Strides."); } @ref->DimensionCount = dimensionCount; @ref->Strides = new(UnsafeUtilities.AllocWithData(Strides)); @ref->WindowSize = new(UnsafeUtilities.AllocWithData(WindowSize)); @ref->StartPadding = new(UnsafeUtilities.AllocWithData(StartPadding)); @ref->EndPadding = new(UnsafeUtilities.AllocWithData(EndPadding)); @ref->IncludePadding = IncludePadding; return(new(@ref)); }
unsafe void IOperatorDescriptionMarshal.__MarshalFree(ref IntPtr pDesc) { var @ref = (__Native *)pDesc; InputTensor.__MarshalFree(ref @ref->InputTensor); InputGradientTensor.__MarshalFree(ref @ref->InputGradientTensor); OutputGradientTensor.__MarshalFree(ref @ref->OutputGradientTensor); UnsafeUtilities.Free(@ref); }
unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc() { __Native * @ref = UnsafeUtilities.Alloc <__Native>(); @ref->InputTensor = InputTensor.__MarshalAlloc(); @ref->InputGradientTensor = InputGradientTensor.__MarshalAlloc(); @ref->OutputGradientTensor = OutputGradientTensor.__MarshalAlloc(); @ref->Minimum = Minimum; @ref->Maximum = Maximum; return(new(@ref)); }
unsafe void IOperatorDescriptionMarshal.__MarshalFree(ref IntPtr pDesc) { var @ref = (__Native *)pDesc; InputGradientTensor.__MarshalFree(ref @ref->InputGradientTensor); OutputGradientTensor.__MarshalFree(ref @ref->OutputGradientTensor); UnsafeUtilities.Free(@ref->Strides); UnsafeUtilities.Free(@ref->WindowSize); UnsafeUtilities.Free(@ref->StartPadding); UnsafeUtilities.Free(@ref->EndPadding); UnsafeUtilities.Free(@ref); }
unsafe void IOperatorDescriptionMarshal.__MarshalFree(ref IntPtr pDesc) { var @ref = (__Native *)pDesc; InputTensor.__MarshalFree(ref @ref->InputTensor); InputGradientTensor.__MarshalFree(ref @ref->InputGradientTensor); MeanTensor.__MarshalFree(ref @ref->MeanTensor); VarianceTensor.__MarshalFree(ref @ref->VarianceTensor); ScaleTensor.__MarshalFree(ref @ref->ScaleTensor); OutputGradientTensor.__MarshalFree(ref @ref->OutputGradientTensor); OutputScaleGradientTensor.__MarshalFree(ref @ref->OutputScaleGradientTensor); OutputBiasGradientTensor.__MarshalFree(ref @ref->OutputBiasGradientTensor); UnsafeUtilities.Free(@ref); }
unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc() { __Native * @ref = UnsafeUtilities.Alloc <__Native>(); @ref->InputTensor = InputTensor.__MarshalAlloc(); @ref->InputGradientTensor = InputGradientTensor.__MarshalAlloc(); @ref->OutputGradientTensor = OutputGradientTensor.__MarshalAlloc(); @ref->CrossChannel = CrossChannel; @ref->LocalSize = LocalSize; @ref->Alpha = Alpha; @ref->Beta = Beta; @ref->Bias = Bias; return(new(@ref)); }
unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc() { __Native * @ref = UnsafeUtilities.Alloc <__Native>(); @ref->InputTensor = InputTensor.__MarshalAlloc(); @ref->InputGradientTensor = InputGradientTensor.__MarshalAlloc(); @ref->MeanTensor = MeanTensor.__MarshalAlloc(); @ref->VarianceTensor = VarianceTensor.__MarshalAlloc(); @ref->ScaleTensor = ScaleTensor.__MarshalAlloc(); @ref->OutputGradientTensor = OutputGradientTensor.__MarshalAlloc(); @ref->OutputScaleGradientTensor = OutputScaleGradientTensor.__MarshalAlloc(); @ref->OutputBiasGradientTensor = OutputBiasGradientTensor.__MarshalAlloc(); @ref->Epsilon = Epsilon; return(new(@ref)); }