示例#1
0
        public void SaveAsOnnx(OnnxContext ctx)
        {
            Host.CheckValue(ctx, nameof(ctx));
            Host.Assert(((ICanSaveOnnx)this).CanSaveOnnx(ctx));

            for (int iinfo = 0; iinfo < _bindings.ColumnTypes.Length; ++iinfo)
            {
                var    columnType      = _bindings.ColumnTypes[iinfo];
                string inputColumnName = Source.Schema[_bindings.SrcCols[iinfo]].Name;
                if (!ctx.ContainsColumn(inputColumnName))
                {
                    continue;
                }

                // If there is already a column of this name, don't add this column as an OptionalColumn/Initializer
                var srcVariableName = ctx.GetVariableName(inputColumnName);
                if (srcVariableName != inputColumnName)
                {
                    continue;
                }

                if (!SaveAsOnnxCore(ctx, srcVariableName, _bindings.ColumnTypes[iinfo]))
                {
                    ctx.RemoveColumn(inputColumnName, true);
                }
            }
        }
示例#2
0
        void ISaveAsOnnx.SaveAsOnnx(OnnxContext ctx)
        {
            Host.CheckValue(ctx, nameof(ctx));
            Host.Assert(((ICanSaveOnnx)this).CanSaveOnnx(ctx));

            for (int iinfo = 0; iinfo < Infos.Length; ++iinfo)
            {
                ColInfo info            = Infos[iinfo];
                string  inputColumnName = Source.Schema[info.Source].Name;
                if (!ctx.ContainsColumn(inputColumnName))
                {
                    ctx.RemoveColumn(info.Name, false);
                    continue;
                }

                if (!SaveAsOnnxCore(ctx, iinfo, info, ctx.GetVariableName(inputColumnName),
                                    ctx.AddIntermediateVariable(OutputSchema[_bindings.MapIinfoToCol(iinfo)].Type, info.Name)))
                {
                    ctx.RemoveColumn(info.Name, true);
                }
            }
        }
示例#3
0
        public void SaveAsOnnx(OnnxContext ctx)
        {
            Host.CheckValue(ctx, nameof(ctx));
            Host.Assert(CanSaveOnnx);

            for (int iinfo = 0; iinfo < Infos.Length; ++iinfo)
            {
                ColInfo info             = Infos[iinfo];
                string  sourceColumnName = Source.Schema.GetColumnName(info.Source);
                if (!ctx.ContainsColumn(sourceColumnName))
                {
                    ctx.RemoveColumn(info.Name, false);
                    continue;
                }

                if (!SaveAsOnnxCore(ctx, iinfo, info, ctx.GetVariableName(sourceColumnName),
                                    ctx.AddIntermediateVariable(Schema.GetColumnType(_bindings.MapIinfoToCol(iinfo)), info.Name)))
                {
                    ctx.RemoveColumn(info.Name, true);
                }
            }
        }
        public void SaveAsOnnx(OnnxContext ctx)
        {
            Host.CheckValue(ctx, nameof(ctx));
            Host.Assert(((ICanSaveOnnx)this).CanSaveOnnx(ctx));

            for (int iinfo = 0; iinfo < _bindings.ColumnTypes.Length; ++iinfo)
            {
                var    columnType      = _bindings.ColumnTypes[iinfo];
                string inputColumnName = Source.Schema[_bindings.SrcCols[iinfo]].Name;
                if (!ctx.ContainsColumn(inputColumnName))
                {
                    continue;
                }

                if (!SaveAsOnnxCore(ctx, iinfo, ctx.GetVariableName(inputColumnName),
                                    ctx.AddIntermediateVariable(OutputSchema[_bindings.MapIinfoToCol(iinfo)].Type, inputColumnName)))
                {
                    ctx.RemoveColumn(inputColumnName, true);
                }
            }
        }