public AutoCond(AutoTFOutput predicate, Func <T> if_true, Func <T> if_false, TFSession session) { TupleRank = typeof(T).GetGenericArguments().Length; TupleSubtypes = typeof(T).GetGenericArguments(); _predicate = predicate; _if_true = if_true; _if_false = if_false; _session = session; }
private static TFSession GetSession(AutoTFOutput a, AutoTFOutput b) { if (a._session == null && b._session == null) { throw new Exception("Cannot calculate graph of two non-tensor values. At least one operant has to be a Tensor"); } if (a._session == null) { a._session = b._session; } if (b._session == null) { b._session = a._session; } return(a._session); }
public void Deconstruct(out AutoTFOutput c, out AutoTFOutput a) { throw new NotImplementedException(); }
public void Deconstruct(out AutoTFOutput a) { var condResult = _session.Graph.Cond(_predicate, () => (_if_true() as Tuple <AutoTFOutput>).Item1, () => (_if_false() as Tuple <AutoTFOutput>).Item1); a = new AutoTFOutput(condResult, _session) as AutoTFOutput; }