unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc()
    {
        __Native * @ref = UnsafeUtilities.Alloc <__Native>();

        @ref->InputTensor  = InputTensor.__MarshalAlloc();
        @ref->OutputTensor = OutputTensor.__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));
    }
Exemple #2
0
    unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc()
    {
        __Native * @ref = UnsafeUtilities.Alloc <__Native>();

        @ref->InputTensor  = InputTensor.__MarshalAlloc();
        @ref->OutputTensor = OutputTensor.__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->InputTensor           = InputTensor.__MarshalAlloc();
        @ref->InputZeroPointTensor  = (InputZeroPointTensor != null) ? InputZeroPointTensor.Value.__MarshalAlloc() : IntPtr.Zero;
        @ref->FilterTensor          = FilterTensor.__MarshalAlloc();
        @ref->FilterZeroPointTensor = (FilterZeroPointTensor != null) ? FilterZeroPointTensor.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 IntPtr IOperatorDescriptionMarshal.__MarshalAlloc()
    {
        __Native * @ref = UnsafeUtilities.Alloc <__Native>();

        @ref->InputGradientTensor  = InputGradientTensor.__MarshalAlloc();
        @ref->OutputGradientTensor = OutputGradientTensor.__MarshalAlloc();
        @ref->InterpolationMode    = InterpolationMode;

        var dimensionCount = Scales.Length;

        if (InputPixelOffsets.Length != dimensionCount)
        {
            throw new IndexOutOfRangeException("InputPixelOffsets must have the same length as Scales.");
        }
        if (OutputPixelOffsets.Length != dimensionCount)
        {
            throw new IndexOutOfRangeException("OutputPixelOffsets must have the same length as Scales.");
        }
        @ref->DimensionCount = dimensionCount;

        @ref->Scales             = new(UnsafeUtilities.AllocWithData(Scales));
        @ref->InputPixelOffsets  = new(UnsafeUtilities.AllocWithData(InputPixelOffsets));
        @ref->OutputPixelOffsets = new(UnsafeUtilities.AllocWithData(OutputPixelOffsets));

        return(new(@ref));
    }
Exemple #5
0
    unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc()
    {
        __Native * @ref = UnsafeUtilities.Alloc <__Native>();

        @ref->InputTensor  = InputTensor.__MarshalAlloc();
        @ref->OutputTensor = OutputTensor.__MarshalAlloc();
        @ref->ScaleBias    = (ScaleBias != null) ? new(UnsafeUtilities.AllocWithData(ScaleBias.Value)) : IntPtr.Zero;

        return(new(@ref));
    }
    unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc()
    {
        __Native * @ref = UnsafeUtilities.Alloc <__Native>();

        @ref->InputTensor  = InputTensor.__MarshalAlloc();
        @ref->OutputTensor = OutputTensor.__MarshalAlloc();
        @ref->RepeatsCount = Repeats.Length;
        @ref->Repeats      = new(UnsafeUtilities.AllocWithData(Repeats));

        return(new(@ref));
    }
Exemple #7
0
    unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc()
    {
        __Native * @ref = UnsafeUtilities.Alloc <__Native>();

        @ref->InputTensor   = InputTensor.__MarshalAlloc();
        @ref->OutputTensor  = OutputTensor.__MarshalAlloc();
        @ref->AxisCount     = Axes.Length;
        @ref->Axes          = new(UnsafeUtilities.AllocWithData(Axes));
        @ref->AxisDirection = AxisDirection;

        return(new(@ref));
    }
    unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc()
    {
        __Native * @ref = UnsafeUtilities.Alloc <__Native>();

        @ref->InputTensor       = InputTensor.__MarshalAlloc();
        @ref->OutputTensor      = OutputTensor.__MarshalAlloc();
        @ref->InterpolationMode = InterpolationMode;
        @ref->ScaleCount        = Scales.Length;
        @ref->Scales            = new(UnsafeUtilities.AllocWithData(Scales));

        return(new(@ref));
    }
Exemple #9
0
    unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc()
    {
        __Native * @ref = UnsafeUtilities.Alloc <__Native>();

        @ref->InputTensor  = InputTensor.__MarshalAlloc();
        @ref->OutputTensor = OutputTensor.__MarshalAlloc();
        @ref->Scale        = Scale;
        @ref->ChannelCount = Bias.Length;
        @ref->Bias         = new(UnsafeUtilities.AllocWithData(Bias));

        return(new(@ref));
    }
    unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc()
    {
        __Native * @ref = UnsafeUtilities.Alloc <__Native>();

        @ref->InputTensor       = InputTensor.__MarshalAlloc();
        @ref->ScaleTensor       = (ScaleTensor != null) ? ScaleTensor.Value.__MarshalAlloc() : IntPtr.Zero;
        @ref->BiasTensor        = (BiasTensor != null) ? BiasTensor.Value.__MarshalAlloc() : IntPtr.Zero;
        @ref->OutputTensor      = OutputTensor.__MarshalAlloc();
        @ref->AxisCount         = Axes.Length;
        @ref->Axes              = new(UnsafeUtilities.AllocWithData(Axes));
        @ref->NormalizeVariance = NormalizeVariance;
        @ref->Epsilon           = Epsilon;
        @ref->FusedActivation   = (FusedActivation != null) ? FusedActivation.Value.__MarshalAlloc() : IntPtr.Zero;

        return(new(@ref));
    }
    unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc()
    {
        __Native * @ref = UnsafeUtilities.Alloc <__Native>();

        @ref->InputTensor  = InputTensor.__MarshalAlloc();
        @ref->OutputTensor = OutputTensor.__MarshalAlloc();
        @ref->PaddingMode  = PaddingMode;
        @ref->PaddingValue = PaddingValue;

        var dimensionCount = StartPadding.Length;

        if (EndPadding.Length != dimensionCount)
        {
            throw new IndexOutOfRangeException("EndPadding must have the same length as StartPadding.");
        }
        @ref->DimensionCount = dimensionCount;

        @ref->StartPadding = new(UnsafeUtilities.AllocWithData(StartPadding));
        @ref->EndPadding   = new(UnsafeUtilities.AllocWithData(EndPadding));

        return(new(@ref));
    }