예제 #1
0
        public override void Save(ModelSaveContext ctx)
        {
            Host.CheckValue(ctx, nameof(ctx));
            ctx.CheckAtModel();
            ctx.SetVersionInfo(GetVersionInfo());

            // *** Binary format ***
            // int: sizeof(Float)
            // bindings
            // for each added column
            //   ColInfoEx

            ctx.Writer.Write(sizeof(Float));
            _bindings.Save(ctx);
            for (int iinfo = 0; iinfo < _exes.Length; iinfo++)
            {
                _exes[iinfo].Save(ctx);
            }
            TextModelHelper.SaveAll(Host, ctx, _exes.Length, _slotNames);
        }
예제 #2
0
        private NgramHashingTransformer(IHost host, ModelLoadContext ctx, IDataView input)
            : base(host, input)
        {
            Host.AssertValue(ctx);

            // *** Binary format ***
            // int: sizeof(Float)
            // bindings
            // for each added column
            //   ColInfoEx

            int cbFloat = ctx.Reader.ReadInt32();

            Host.CheckDecode(cbFloat == sizeof(Float));
            _bindings = new Bindings(ctx, Source.Schema, this);
            _exes     = new ColInfoEx[_bindings.Infos.Length];

            for (int iinfo = 0; iinfo < _bindings.Infos.Length; iinfo++)
            {
                _exes[iinfo] = new ColInfoEx(ctx);
            }
            InitColumnTypes();
            TextModelHelper.LoadAll(Host, ctx, _exes.Length, out _slotNames, out _slotNamesTypes);
        }