public virtual void CopyParametersTo(LayerBase target, float tau = float.NaN) { if (!InputShapes.Equals(target.InputShapes) || !OutputShape.Equals(target.OutputShape)) { throw new Exception("Cannot copy parameters between incompatible layers."); } }
public override void VisitLeaf(ITreeValueNode node) { if (!TreeNodeIsDimensionVariable(node)) { base.VisitLeaf(node); return; } else { (ITreeValueNode parent, int dim) = GetDimensionVariableParent(node); if (Tree.InputVariableNodes.Contains(parent)) { base.VisitLeaf(node); return; } else { ITermShape parentShape = parent.ValueAs <ITermShape>(); ITermShape substituteParentShape = InputShapes.FirstOrDefault(s => s.Dimensions.SequenceEqual(parentShape.Dimensions)); if (substituteParentShape == null) { throw new TileGeneratorException(this, "Could not find input variable node to substitute for " + $"{parentShape.Label}."); } else { Context.Push(substituteParentShape.Label.ToUpper() + "DIM" + dim.ToString()); } } } }