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

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

        @ref->InputTensor             = InputTensor.__MarshalAlloc();
        @ref->WeightTensor            = WeightTensor.__MarshalAlloc();
        @ref->RecurrenceTensor        = RecurrenceTensor.__MarshalAlloc();
        @ref->BiasTensor              = (BiasTensor != null) ? BiasTensor.Value.__MarshalAlloc() : IntPtr.Zero;
        @ref->HiddenInitializerTensor = (HiddenInitializerTensor != null) ? HiddenInitializerTensor.Value.__MarshalAlloc() : IntPtr.Zero;
        @ref->SequenceLengthsTensor   = (SequenceLengthsTensor != null) ? SequenceLengthsTensor.Value.__MarshalAlloc() : IntPtr.Zero;
        @ref->OutputSequenceTensor    = (OutputSequenceTensor != null) ? OutputSequenceTensor.Value.__MarshalAlloc() : IntPtr.Zero;
        @ref->OutputSingleTensor      = (OutputSingleTensor != null) ? OutputSingleTensor.Value.__MarshalAlloc() : IntPtr.Zero;
        @ref->ActivationDescCount     = Activations.Length;

        @ref->Activations = IntPtr.Zero;
        if (Activations.Length != 0)
        {
            var activationDescsPtr = UnsafeUtilities.Alloc <OperatorDescription.__Native>(Activations.Length);
            for (int i = 0; i < Activations.Length; i++)
            {
                Activations[i].__MarshalTo(ref activationDescsPtr[i]);
            }
            @ref->Activations = new(activationDescsPtr);
        }

        @ref->Direction = Direction;

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

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

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

        @ref->InputTensor     = InputTensor.__MarshalAlloc();
        @ref->OutputTensor    = OutputTensor.__MarshalAlloc();
        @ref->Axis            = Axis;
        @ref->AxisDirection   = AxisDirection;
        @ref->HasExclusiveSum = HasExclusiveSum;

        return(new(@ref));
    }
Пример #10
0
    unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc()
    {
        __Native * @ref = UnsafeUtilities.Alloc <__Native>();

        @ref->InputTensor  = InputTensor.__MarshalAlloc();
        @ref->RoiTensor    = RoiTensor.__MarshalAlloc();
        @ref->OutputTensor = OutputTensor.__MarshalAlloc();
        @ref->SpatialScale = SpatialScale;
        @ref->PooledSize   = PooledSize;

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

        @ref->InputTensor = InputTensor.__MarshalAlloc();
        @ref->IndicesTensor = IndicesTensor.__MarshalAlloc();
        @ref->OutputTensor = OutputTensor.__MarshalAlloc();
        @ref->Axis = Axis;
        @ref->IndexDimensions = IndexDimensions;

        return new(@ref);
    }
Пример #12
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));
    }
Пример #13
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->OutputTensor      = OutputTensor.__MarshalAlloc();
        @ref->InterpolationMode = InterpolationMode;
        @ref->ScaleCount        = Scales.Length;
        @ref->Scales            = new(UnsafeUtilities.AllocWithData(Scales));

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

        @ref->InputTensor           = InputTensor.__MarshalAlloc();
        @ref->IndicesTensor         = IndicesTensor.__MarshalAlloc();
        @ref->UpdatesTensor         = UpdatesTensor.__MarshalAlloc();
        @ref->OutputTensor          = OutputTensor.__MarshalAlloc();
        @ref->InputDimensionCount   = InputDimensionCount;
        @ref->IndicesDimensionCount = IndicesDimensionCount;

        return(new(@ref));
    }
Пример #16
0
    unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc()
    {
        __Native * @ref = UnsafeUtilities.Alloc <__Native>();

        @ref->InputTensor       = InputTensor.__MarshalAlloc();
        @ref->OutputValueTensor = OutputValueTensor.__MarshalAlloc();
        @ref->OutputIndexTensor = OutputIndexTensor.__MarshalAlloc();
        @ref->Axis          = Axis;
        @ref->K             = K;
        @ref->AxisDirection = AxisDirection;

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

        @ref->InputTensor          = InputTensor.__MarshalAlloc();
        @ref->InputGradientTensor  = InputGradientTensor.__MarshalAlloc();
        @ref->OutputGradientTensor = OutputGradientTensor.__MarshalAlloc();
        @ref->MinMaxDataType       = MinMaxDataType;
        @ref->Minimum = Minimum;
        @ref->Maximum = Maximum;

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

        @ref->InputTensor  = InputTensor.__MarshalAlloc();
        @ref->OutputTensor = OutputTensor.__MarshalAlloc();
        @ref->CrossChannel = CrossChannel;
        @ref->LocalSize    = LocalSize;
        @ref->Alpha        = Alpha;
        @ref->Beta         = Beta;
        @ref->Bias         = Bias;

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

        @ref->InputTensor     = InputTensor.__MarshalAlloc();
        @ref->MeanTensor      = MeanTensor.__MarshalAlloc();
        @ref->VarianceTensor  = VarianceTensor.__MarshalAlloc();
        @ref->ScaleTensor     = ScaleTensor.__MarshalAlloc();
        @ref->BiasTensor      = BiasTensor.__MarshalAlloc();
        @ref->OutputTensor    = OutputTensor.__MarshalAlloc();
        @ref->Spatial         = Spatial;
        @ref->Epsilon         = Epsilon;
        @ref->FusedActivation = (FusedActivation != null) ? FusedActivation.Value.__MarshalAlloc() : IntPtr.Zero;

        return(new(@ref));
    }
Пример #22
0
    unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc()
    {
        __Native * @ref = UnsafeUtilities.Alloc <__Native>();

        @ref->InputTensor             = InputTensor.__MarshalAlloc();
        @ref->RoiTensor               = RoiTensor.__MarshalAlloc();
        @ref->BatchIndicesTensor      = BatchIndicesTensor.__MarshalAlloc();
        @ref->OutputTensor            = OutputTensor.__MarshalAlloc();
        @ref->ReductionFunction       = ReductionFunction;
        @ref->InterpolationMode       = InterpolationMode;
        @ref->SpatialScaleX           = SpatialScaleX;
        @ref->SpatialScaleY           = SpatialScaleY;
        @ref->OutOfBoundsInputValue   = OutOfBoundsInputValue;
        @ref->MinimumSamplesPerOutput = MinimumSamplesPerOutput;
        @ref->MaximumSamplesPerOutput = MaximumSamplesPerOutput;

        return(new(@ref));
    }
Пример #23
0
    unsafe IntPtr IOperatorDescriptionMarshal.__MarshalAlloc()
    {
        __Native * @ref = UnsafeUtilities.Alloc <__Native>();

        @ref->InputTensor = InputTensor.__MarshalAlloc();
        @ref->OutputCount = OutputTensors.Length;

        @ref->OutputTensors = IntPtr.Zero;
        if (OutputTensors.Length != 0)
        {
            var outputTensorsPtr = UnsafeUtilities.Alloc <TensorDescription.__Native>(OutputTensors.Length);
            for (int i = 0; i < OutputTensors.Length; i++)
            {
                OutputTensors[i].__MarshalTo(ref outputTensorsPtr[i]);
            }
            @ref->OutputTensors = new(outputTensorsPtr);
        }

        @ref->Axis = Axis;

        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));
    }