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 void IOperatorDescriptionMarshal.__MarshalFree(ref IntPtr pDesc)
    {
        var @ref = (__Native *)pDesc;

        if (InputTensor != null)
        {
            InputTensor.Value.__MarshalFree(ref @ref->InputTensor);
        }

        InputGradientTensor.__MarshalFree(ref @ref->InputGradientTensor);
        RoiTensor.__MarshalFree(ref @ref->RoiTensor);
        BatchIndicesTensor.__MarshalFree(ref @ref->BatchIndicesTensor);

        if (OutputGradientTensor != null)
        {
            OutputGradientTensor.Value.__MarshalFree(ref @ref->OutputGradientTensor);
        }

        if (OutputROIGradientTensor != null)
        {
            OutputROIGradientTensor.Value.__MarshalFree(ref @ref->OutputROIGradientTensor);
        }

        UnsafeUtilities.Free(@ref);
    }
Пример #3
0
    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();

        return(new(@ref));
    }
Пример #6
0
    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);
    }
Пример #8
0
    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));
    }
    unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc()
    {
        __Native * @ref = UnsafeUtilities.Alloc <__Native>();

        @ref->InputTensor             = (InputTensor != null) ? InputTensor.Value.__MarshalAlloc() : IntPtr.Zero;
        @ref->InputGradientTensor     = InputGradientTensor.__MarshalAlloc();
        @ref->RoiTensor               = RoiTensor.__MarshalAlloc();
        @ref->BatchIndicesTensor      = BatchIndicesTensor.__MarshalAlloc();
        @ref->OutputGradientTensor    = (OutputGradientTensor != null) ? OutputGradientTensor.Value.__MarshalAlloc() : IntPtr.Zero;
        @ref->OutputROIGradientTensor = (OutputROIGradientTensor != null) ? OutputROIGradientTensor.Value.__MarshalAlloc() : IntPtr.Zero;
        @ref->ReductionFunction       = ReductionFunction;
        @ref->InterpolationMode       = InterpolationMode;
        @ref->SpatialScaleX           = SpatialScaleX;
        @ref->SpatialScaleY           = SpatialScaleY;
        @ref->InputPixelOffset        = InputPixelOffset;
        @ref->OutputPixelOffset       = OutputPixelOffset;
        @ref->MinimumSamplesPerOutput = MinimumSamplesPerOutput;
        @ref->MaximumSamplesPerOutput = MaximumSamplesPerOutput;
        @ref->AlignRegionsToCorners   = AlignRegionsToCorners;

        return(new(@ref));
    }