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));
    }
示例#2
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 IntPtr IOperatorDescriptionMarshal.__MarshalAlloc()
    {
        __Native * @ref = UnsafeUtilities.Alloc <__Native>();

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

        return(new(@ref));
    }
示例#4
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));
    }