public static SortInDataFrameTransform Create(IHostEnvironment env, ModelLoadContext ctx, IDataView input) { Contracts.CheckValue(env, "env"); var h = env.Register(RegistrationName); h.CheckValue(ctx, "ctx"); h.CheckValue(input, "input"); ctx.CheckAtModel(GetVersionInfo()); return(h.Apply("Loading Model", ch => new SortInDataFrameTransform(h, ctx, input))); }
private SortInDataFrameTransform(IHost host, ModelLoadContext ctx, IDataView input) : base(host, input) { Host.CheckValue(input, "input"); Host.CheckValue(ctx, "ctx"); _sortColumn = ctx.Reader.ReadString(); Host.AssertValue(_sortColumn); var schema = input.Schema; int index = SchemaHelper.GetColumnIndex(schema, _sortColumn); var type = schema[index].Type; Host.Check(!type.IsVector(), "sortColumn cannot be a vector."); _reverse = ctx.Reader.ReadBoolean(); _numThreads = ctx.Reader.ReadInt32(); if (_numThreads < 0) { _numThreads = null; } _transform = CreateTemplatedTransform(); }
private ExtendedCacheTransform(IHost host, ModelLoadContext ctx, IDataView input) : base(host, input) { Host.CheckValue(input, "input"); Host.CheckValue(ctx, "ctx"); _inDataFrame = ctx.Reader.ReadBoolean(); _async = ctx.Reader.ReadBoolean(); _numThreads = ctx.Reader.ReadInt32(); host.Check(_numThreads > -2, "_numThreads"); if (_numThreads < 0) { _numThreads = null; } _saverSettings = ctx.Reader.ReadString(); if (_inDataFrame) { _cacheFile = null; _reuse = false; } else { _cacheFile = ctx.Reader.ReadString(); _reuse = ctx.Reader.ReadBoolean(); host.CheckValue(_cacheFile, "_cacheFile"); } var saver = ComponentCreation.CreateSaver(Host, _saverSettings); if (saver == null) { throw Host.Except("Cannot parse '{0}'", _saverSettings); } _pipedTransform = CreatePipeline(host, input); }