public MultiCountTable(IHostEnvironment env, ModelLoadContext ctx) : base(env, LoaderSignature) { Host.CheckValue(ctx, nameof(ctx)); ctx.CheckAtModel(GetVersionInfo()); // *** Binary format *** // number of columns // for each column, number of slots // Sub-models: // count tables (each in a separate folder) int n = ctx.Reader.ReadInt32(); Host.CheckDecode(n > 0); _countTables = new CountTableBase[n][]; for (int i = 0; i < n; i++) { var size = ctx.Reader.ReadInt32(); Host.CheckDecode(size > 0); _countTables[i] = new CountTableBase[size]; for (int j = 0; j < size; j++) { var tableName = string.Format("Table_{0:000}_{1:000}", i, j); ctx.LoadModel <CountTableBase, SignatureLoadModel>(Host, out _countTables[i][j], tableName); } } }
public MultiCountTable(IHostEnvironment env, CountTableBase baseTable, int colCount, int[] slotCount) : base(env, LoaderSignature) { _baseTable = baseTable; ColCount = colCount; SlotCount = slotCount; }
public override MultiCountTableBase CreateMultiCountTable() { var n = _countTableBuilders.Length; var countTables = new CountTableBase[n][]; for (int i = 0; i < n; i++) { int size = _countTableBuilders[i].Length; countTables[i] = new CountTableBase[size]; for (int j = 0; j < size; j++) { countTables[i][j] = _countTableBuilders[i][j].CreateCountTable(); } } return(new MultiCountTable(_host, countTables)); }