//Constructors /// <summary> /// Creates an itialized instance. /// </summary> /// <param name="index">An index of this readout unit within the readout layer.</param> /// <param name="readoutUnitCfg">The configuration of the readout unit.</param> /// <param name="taskDefaultsCfg">The tasks defaults configuration.</param> public ReadoutUnit(int index, ReadoutUnitSettings readoutUnitCfg, TaskDefaultsSettings taskDefaultsCfg ) { Index = index; Name = readoutUnitCfg.Name; Task = readoutUnitCfg.TaskCfg.Type; if (readoutUnitCfg.TaskCfg.GetType() == typeof(ForecastTaskSettings)) { _clusterChainCfg = (ITNRNetClusterChainSettings)((ForecastTaskSettings)readoutUnitCfg.TaskCfg).ClusterChainCfg?.DeepClone(); if (_clusterChainCfg == null) { _clusterChainCfg = taskDefaultsCfg.ForecastClusterChainCfg; } } else { _clusterChainCfg = (ITNRNetClusterChainSettings)((ClassificationTaskSettings)readoutUnitCfg.TaskCfg).ClusterChainCfg?.DeepClone(); { if (_clusterChainCfg == null) { _clusterChainCfg = taskDefaultsCfg.ClassificationClusterChainCfg; } } } _clusterChain = null; return; }
//Constructors /// <summary> /// Creates an initialized instance. /// </summary> /// <param name="taskDefaultsCfg">The default configurations of the readout unit tasks.</param> /// <param name="readoutUnitsCfg">The configuration of the readout units.</param> /// <param name="oneTakesAllGroupsCfg">The configuration of the "One Takes All" groups.</param> public ReadoutLayerSettings(TaskDefaultsSettings taskDefaultsCfg, ReadoutUnitsSettings readoutUnitsCfg, OneTakesAllGroupsSettings oneTakesAllGroupsCfg = null ) { TaskDefaultsCfg = (TaskDefaultsSettings)taskDefaultsCfg.DeepClone(); ReadoutUnitsCfg = (ReadoutUnitsSettings)readoutUnitsCfg.DeepClone(); OneTakesAllGroupsCfg = (OneTakesAllGroupsSettings)oneTakesAllGroupsCfg?.DeepClone(); Check(); return; }
/// <summary> /// Creates an initialized instance. /// </summary> /// <param name="elem">A xml element containing the configuration data.</param> public ReadoutLayerSettings(XElement elem) { //Validation XElement settingsElem = Validate(elem, XsdTypeName); //Parsing //Cluster TaskDefaultsCfg = new TaskDefaultsSettings(settingsElem.Element("taskDefaults")); //Readout units XElement readoutUnitsElem = settingsElem.Elements("readoutUnits").First(); ReadoutUnitsCfg = new ReadoutUnitsSettings(readoutUnitsElem); //One-takes-all groups XElement oneTakesAllGroupsElem = settingsElem.Elements("oneTakesAllGroups").FirstOrDefault(); OneTakesAllGroupsCfg = oneTakesAllGroupsElem == null ? null : new OneTakesAllGroupsSettings(oneTakesAllGroupsElem); Check(); return; }
/// <summary> /// The copy constructor. /// </summary> /// <param name="source">The source instance.</param> public TaskDefaultsSettings(TaskDefaultsSettings source) : this(source.ClassificationClusterChainCfg, source.ForecastClusterChainCfg) { return; }