unsafe void IOperatorDescriptionMarshal.__MarshalFree(ref IntPtr pDesc) { var @ref = (__Native *)pDesc; ATensor.__MarshalFree(ref @ref->ATensor); AScaleTensor.__MarshalFree(ref @ref->AScaleTensor); if (AZeroPointTensor != null) { AZeroPointTensor.Value.__MarshalFree(ref @ref->AZeroPointTensor); } BTensor.__MarshalFree(ref @ref->BTensor); BScaleTensor.__MarshalFree(ref @ref->BScaleTensor); if (BZeroPointTensor != null) { BZeroPointTensor.Value.__MarshalFree(ref @ref->BZeroPointTensor); } OutputScaleTensor.__MarshalFree(ref @ref->OutputScaleTensor); if (OutputZeroPointTensor != null) { OutputZeroPointTensor.Value.__MarshalFree(ref @ref->OutputZeroPointTensor); } OutputTensor.__MarshalFree(ref @ref->OutputTensor); UnsafeUtilities.Free(@ref); }
unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc() { __Native* @ref = UnsafeUtilities.Alloc<__Native>(); @ref->InputTensor = InputTensor.__MarshalAlloc(); @ref->InputScaleTensor = InputScaleTensor.__MarshalAlloc(); @ref->InputZeroPointTensor = (InputZeroPointTensor != null) ? InputZeroPointTensor.Value.__MarshalAlloc() : IntPtr.Zero; @ref->FilterTensor = FilterTensor.__MarshalAlloc(); @ref->FilterScaleTensor = FilterScaleTensor.__MarshalAlloc(); @ref->FilterZeroPointTensor = (FilterZeroPointTensor != null) ? FilterZeroPointTensor.Value.__MarshalAlloc() : IntPtr.Zero; @ref->BiasTensor = (BiasTensor != null) ? BiasTensor.Value.__MarshalAlloc() : IntPtr.Zero; @ref->OutputScaleTensor = OutputScaleTensor.__MarshalAlloc(); @ref->OutputZeroPointTensor = (OutputZeroPointTensor != null) ? OutputZeroPointTensor.Value.__MarshalAlloc() : IntPtr.Zero; @ref->OutputTensor = OutputTensor.__MarshalAlloc(); var dimensionCount = Strides.Length; if (Dilations.Length != dimensionCount) { throw new IndexOutOfRangeException("Dilations 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->Dilations = new(UnsafeUtilities.AllocWithData(Dilations)); @ref->StartPadding = new(UnsafeUtilities.AllocWithData(StartPadding)); @ref->EndPadding = new(UnsafeUtilities.AllocWithData(EndPadding)); @ref->GroupCount = GroupCount; return new(@ref); }
unsafe void IOperatorDescriptionMarshal.__MarshalFree(ref IntPtr pDesc) { var @ref = (__Native *)pDesc; InputTensor.__MarshalFree(ref @ref->InputTensor); OutputTensor.__MarshalFree(ref @ref->OutputTensor); OutputScaleTensor.__MarshalFree(ref @ref->OutputScaleTensor); OutputZeroPointTensor.__MarshalFree(ref @ref->OutputZeroPointTensor); UnsafeUtilities.Free(@ref); }
unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc() { __Native * @ref = UnsafeUtilities.Alloc <__Native>(); @ref->InputTensor = InputTensor.__MarshalAlloc(); @ref->OutputTensor = OutputTensor.__MarshalAlloc(); @ref->OutputScaleTensor = OutputScaleTensor.__MarshalAlloc(); @ref->OutputZeroPointTensor = OutputZeroPointTensor.__MarshalAlloc(); return(new(@ref)); }
unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc() { __Native * @ref = UnsafeUtilities.Alloc <__Native>(); @ref->ATensor = ATensor.__MarshalAlloc(); @ref->AScaleTensor = AScaleTensor.__MarshalAlloc(); @ref->AZeroPointTensor = (AZeroPointTensor != null) ? AZeroPointTensor.Value.__MarshalAlloc() : IntPtr.Zero; @ref->BTensor = BTensor.__MarshalAlloc(); @ref->BScaleTensor = BScaleTensor.__MarshalAlloc(); @ref->BZeroPointTensor = (BZeroPointTensor != null) ? BZeroPointTensor.Value.__MarshalAlloc() : IntPtr.Zero; @ref->OutputScaleTensor = OutputScaleTensor.__MarshalAlloc(); @ref->OutputZeroPointTensor = (OutputZeroPointTensor != null) ? OutputZeroPointTensor.Value.__MarshalAlloc() : IntPtr.Zero; @ref->OutputTensor = OutputTensor.__MarshalAlloc(); return(new(@ref)); }
unsafe void IOperatorDescriptionMarshal.__MarshalFree(ref IntPtr pDesc) { var @ref = (__Native*)pDesc; InputTensor.__MarshalFree(ref @ref->InputTensor); InputScaleTensor.__MarshalFree(ref @ref->InputScaleTensor); if (InputZeroPointTensor != null) { InputZeroPointTensor.Value.__MarshalFree(ref @ref->InputZeroPointTensor); } FilterTensor.__MarshalFree(ref @ref->FilterTensor); FilterScaleTensor.__MarshalFree(ref @ref->FilterScaleTensor); if (FilterZeroPointTensor != null) { FilterZeroPointTensor.Value.__MarshalFree(ref @ref->FilterZeroPointTensor); } if (BiasTensor != null) { BiasTensor.Value.__MarshalFree(ref @ref->BiasTensor); } OutputScaleTensor.__MarshalFree(ref @ref->OutputScaleTensor); if (OutputZeroPointTensor != null) { OutputZeroPointTensor.Value.__MarshalFree(ref @ref->OutputZeroPointTensor); } OutputTensor.__MarshalFree(ref @ref->OutputTensor); UnsafeUtilities.Free(@ref->Strides); UnsafeUtilities.Free(@ref->Dilations); UnsafeUtilities.Free(@ref->StartPadding); UnsafeUtilities.Free(@ref->EndPadding); UnsafeUtilities.Free(@ref); }