/** @copydoc LayerParameterBase::Copy */ public override void Copy(LayerParameterBase src) { ScalarParameter p = (ScalarParameter)src; m_dfVal = p.m_dfVal; m_op = p.m_op; m_bPassthroughGradient = p.m_bPassthroughGradient; }
public override void Visit(GetEntityRefOp op, System.Data.Entity.Core.Query.InternalTrees.Node n) { ScalarOp op1 = n.Child0.Op as ScalarOp; System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler.Assert(op1 != null, "input to GetEntityRefOp is not a ScalarOp?"); PropertyRefList identityProperties = PropertyPushdownHelper.GetIdentityProperties(TypeHelpers.GetEdmType <EntityType>(op1.Type)); this.AddPropertyRefs(n.Child0, identityProperties); this.VisitNode(n.Child0); }
public static RCArray <O> MonadicOp <R, O> (RCArray <R> right, ScalarOp <R, O> op) { RCArray <O> output = new RCArray <O> (right.Count); for (int i = 0; i < right.Count; ++i) { output.Write(op(right[i])); } return(output); }
protected override void VisitDefault(System.Data.Entity.Core.Query.InternalTrees.Node n) { foreach (System.Data.Entity.Core.Query.InternalTrees.Node child in n.Children) { ScalarOp op = child.Op as ScalarOp; if (op != null && TypeUtils.IsStructuredType(op.Type)) { this.AddPropertyRefs(child, PropertyRefList.All); } } this.VisitChildren(n); }
protected override Node VisitScalarOpDefault(ScalarOp op, Node n) { if (op.OpType != OpType.EQ) { return(base.VisitScalarOpDefault(op, n)); } var result = ImplementEquality(n); _modified |= !ReferenceEquals(n, result); return(result); }
/// <summary> /// Default visitor for an Op. /// /// Simply walks through all children looking for Ops of structured /// types, and asks for all their properties. /// </summary> /// <remarks> /// Several of the ScalarOps take the default handling, to simply ask /// for all the children's properties: /// /// AggegateOp /// ArithmeticOp /// CastOp /// ConditionalOp /// ConstantOp /// ElementOp /// ExistsOp /// FunctionOp /// GetRefKeyOp /// LikeOp /// NestAggregateOp /// NewInstanceOp /// NewMultisetOp /// NewRecordOp /// RefOp /// /// They do not exist here to eliminate noise. /// /// Note that the NewRecordOp and the NewInstanceOp could be optimized to only /// push down the appropriate references, but it isn't clear to Murali that the /// complexity is worth it. /// </remarks> /// <param name="n"></param> protected override void VisitDefault(Node n) { // for each child that is a complex type, simply ask for all properties foreach (Node chi in n.Children) { ScalarOp chiOp = chi.Op as ScalarOp; if (chiOp != null && TypeUtils.IsStructuredType(chiOp.Type)) { AddPropertyRefs(chi, PropertyRefList.All); } } VisitChildren(n); }
/// <summary> /// GetEntityRefOp handling /// /// Ask for the "identity" properties from the input entity, and push that /// down to my child /// </summary> /// <param name="op"></param> /// <param name="n"></param> public override void Visit(GetEntityRefOp op, Node n) { ScalarOp childOp = n.Child0.Op as ScalarOp; PlanCompiler.Assert(childOp != null, "input to GetEntityRefOp is not a ScalarOp?"); // md.EntityType entityType = TypeHelpers.GetEdmType <md.EntityType>(childOp.Type); PropertyRefList desiredProperties = GetIdentityProperties(entityType); AddPropertyRefs(n.Child0, desiredProperties); VisitNode(n.Child0); }
public static RCArray <O> DyadicOp <L, R, O> (RCArray <L> left, RCArray <R> right, ScalarOp <L, R, O> op) { if (left.Count == 1) { RCArray <O> output = new RCArray <O> (right.Count); for (int i = 0; i < right.Count; ++i) { output.Write(op(left[0], right[i])); } return(output); } else if (right.Count == 1) { RCArray <O> output = new RCArray <O> (left.Count); for (int i = 0; i < left.Count; ++i) { output.Write(op(left[i], right[0])); } return(output); } else if (left.Count == right.Count) { RCArray <O> output = new RCArray <O> (left.Count); for (int i = 0; i < left.Count; ++i) { output.Write(op(left[i], right[i])); } return(output); } else { throw new Exception( "Both vectors must have the same count, or one of them must have a single element."); } }
// <summary> // A default processor for all ScalarOps. // Allows new visitors to just override this to handle all ScalarOps // </summary> // <param name="op"> the ScalarOp </param> // <param name="n"> the node to process </param> // <returns> a potentially new node </returns> protected override Node VisitScalarOpDefault(ScalarOp op, Node n) { return(VisitDefault(n)); }