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

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

        return(new(@ref));
    }
Esempio n. 2
0
    unsafe void IOperatorDescriptionMarshal.__MarshalFree(ref IntPtr pDesc)
    {
        var @ref = (__Native *)pDesc;

        InputTensor.__MarshalFree(ref @ref->InputTensor);
        ExponentTensor.__MarshalFree(ref @ref->ExponentTensor);
        OutputTensor.__MarshalFree(ref @ref->OutputTensor);

        if (@ref->ScaleBias != IntPtr.Zero)
        {
            UnsafeUtilities.Free(@ref->ScaleBias);
        }

        UnsafeUtilities.Free(@ref);
    }