public Stat() { Rta = new Rta(); Networks = new Networks(); Tape = new Tape(); Usb = new Usb(); }
private async Task <IReadOnlyDictionary <String, String> > listConditionsAsync( Tape tape, String tickType, CancellationToken cancellationToken = default) => await _httpClient.GetAsync <IReadOnlyDictionary <String, String>, Dictionary <String, String> >(
public Rental(string daysRented, Tape tape) { DaysRented = daysRented; Tape = tape; }
public Task <IReadOnlyDictionary <String, String> > ListQuoteConditionsAsync( Tape tape, CancellationToken cancellationToken = default) => listConditionsAsync(tape, "quote", cancellationToken);
public static void basic_backprop_with_a_split_node_accumulates_gradients() { ENV.engine = new Engine(); var x = alb.scalar(0); var intermediate1 = alb.scalar(1); var intermediate2 = alb.scalar(2); var y = alb.scalar(3); var dy = alb.scalar(1); Dictionary <int, Tensor> accumulatedGradientsMap = new Dictionary <int, Tensor>(); accumulatedGradientsMap.Add(y.id, dy); TapeNode node0 = new TapeNode(); node0.id = 0; node0.name = "node0"; node0.inputs = new Dictionary <string, Tensor>(); node0.inputs.Add("x", x); node0.output = intermediate1; node0.gradient = (Tensor dy2) => { NamedGradientMap ngm = new NamedGradientMap(); ngm.gradient.Add("x", () => { return(dy2.add(alb.scalar(1))); }); return(ngm); }; TapeNode node1 = new TapeNode(); node1.id = 1; node1.name = "node1"; node1.inputs = new Dictionary <string, Tensor>(); node1.inputs.Add("x", x); node1.output = intermediate2; node1.gradient = (Tensor dy2) => { NamedGradientMap ngm = new NamedGradientMap(); ngm.gradient.Add("x", () => { return(dy2.add(alb.scalar(1))); }); return(ngm); }; TapeNode node2 = new TapeNode(); node2.id = 2; node2.name = "node2"; node2.inputs = new Dictionary <string, Tensor>(); node2.inputs.Add("intermediate1", intermediate1); node2.inputs.Add("intermediate2", intermediate2); node2.output = y; node2.gradient = (Tensor dy2) => { NamedGradientMap ngm = new NamedGradientMap(); ngm.gradient.Add("intermediate1", () => { return(dy2.add(alb.scalar(1))); }); ngm.gradient.Add("intermediate2", () => { return(dy2.add(alb.scalar(1))); }); return(ngm); }; TapeNode[] tape = new TapeNode[] { node0, node1, node2 }; Tape.backpropagateGradients(accumulatedGradientsMap, tape); AssertTools.ArrayIsEqual(accumulatedGradientsMap[x.id].dataSync(), new float[] { dy.dataSync()[0] + 5 }); }
private void Awake() { Instance = this; }
public VmState(int tapeSize) { Tape = new Tape <bool>(tapeSize); }
public void basic_backprop_with_2_node() { ENV.engine = new Engine(); var x = alb.scalar(0); var intermediate = alb.scalar(1); var y = alb.scalar(2); var dy = alb.scalar(1); Dictionary <int, Tensor> accumulatedGradientsMap = new Dictionary <int, Tensor>(); accumulatedGradientsMap.Add(y.id, dy); var input1 = new System.Collections.Generic.Dictionary <string, Tensor>(); input1.Add("x", x); var input2 = new System.Collections.Generic.Dictionary <string, Tensor>(); input2.Add("intermediate", intermediate); TapeNode[] tape = new TapeNode[] { new TapeNode() { gradient = (Tensor dy2) => { NamedGradientMap ngm = new NamedGradientMap(); ngm.gradient.Add("x", () => { return(dy2.add(alb.scalar(1))); }); return(ngm); } , id = 0 , inputs = input1, name = "node0", output = intermediate } , new TapeNode() { gradient = (Tensor dy2) => { NamedGradientMap ngm = new NamedGradientMap(); ngm.gradient.Add("intermediate", () => { return(dy2.add(alb.scalar(1))); }); return(ngm); } , id = 1 , inputs = input2, name = "node1", output = y } }; Tape.backpropagateGradients(accumulatedGradientsMap, tape); AssertTools.ArrayIsEqual(accumulatedGradientsMap[x.id].dataSync(), new float[] { 3 }); }
private Tape(Tape tape) { right = new List <bool>(tape.right); left = new List <bool>(tape.left); }
//Add a new tape to the database and return the tape id public int CreateTape(Tape tape) { _dbContext.Tapes.Add(tape); _dbContext.SaveChanges(); return(tape.Id); }
private void Awake() => tape = GameObject.FindObjectOfType <Tape>();
public void ClearTape() { Tape.Clear(); CurrentPositionOnTape = NO_TAPE; }
public void Noid(string param) { var p = TestProxyFactory.Create(); Session sessionToExamine = null; p.BeforeRequest += session => { sessionToExamine = session; string pathAndQuery; string host; string q = session.PathAndQuery.TrimStart('/'); host = Utilities.TrimAfter(q, "/"); if (q.IndexOf('/') > -1) { pathAndQuery = "/" + Utilities.TrimBefore(q, "/"); } else { pathAndQuery = "/"; } session.host = host; session.PathAndQuery = pathAndQuery; }; p.Start(); try { new WebClient().UploadString("http://localhost.:" + TestProxyFactory.Port + "/httpbin.org/post?foo=" + param, "bar=" + param); // lets try to round-trip the captured session Tape tape = HttpArchiveTranscoder.Export(new[] { sessionToExamine }); var json = JsonConvert.SerializeObject(tape.log.entries[0], Formatting.Indented); var sessionOut = HttpArchiveTranscoder.Import(tape)[0]; bool fail = false; if (sessionToExamine.PathAndQuery != sessionOut.PathAndQuery) { fail = true; Console.WriteLine("PathAndQuery"); } if (!CompareByteArrays(sessionToExamine.RequestBody, sessionOut.RequestBody, "RequestBody")) { fail = true; Console.WriteLine("RequestBody"); Console.WriteLine("--------------------------------------------------------"); Console.WriteLine(Encoding.UTF8.GetString(sessionToExamine.RequestBody)); Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); Console.WriteLine(Encoding.UTF8.GetString(sessionOut.RequestBody)); Console.WriteLine("--------------------------------------------------------"); } if (!CompareByteArrays(sessionToExamine.ResponseBody, sessionOut.ResponseBody, "ResponseBody")) { fail = true; Console.WriteLine("ResponseBody"); Console.WriteLine("--------------------------------------------------------"); Console.WriteLine(Encoding.UTF8.GetString(sessionToExamine.ResponseBody)); Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); Console.WriteLine(Encoding.UTF8.GetString(sessionOut.ResponseBody)); Console.WriteLine("--------------------------------------------------------"); } // fiddler static inc if (sessionToExamine.SuggestedFilename != sessionOut.SuggestedFilename) Console.WriteLine("SuggestedFilename"); if (sessionToExamine.TunnelEgressByteCount != sessionOut.TunnelEgressByteCount) { fail = true; Console.WriteLine("TunnelEgressByteCount"); } if (sessionToExamine.TunnelIngressByteCount != sessionOut.TunnelIngressByteCount) { fail = true; Console.WriteLine("TunnelIngressByteCount"); } if (sessionToExamine.TunnelIsOpen != sessionOut.TunnelIsOpen) { fail = true; Console.WriteLine("TunnelIsOpen"); } if (sessionToExamine.bHasResponse != sessionOut.bHasResponse) { fail = true; Console.WriteLine("bHasResponse"); } if (sessionToExamine.bypassGateway != sessionOut.bypassGateway) { fail = true; Console.WriteLine("bypassGateway"); } if (sessionToExamine.fullUrl != sessionOut.fullUrl) { fail = true; Console.WriteLine("fullUrl"); } if (sessionToExamine.host != sessionOut.host) { fail = true; Console.WriteLine("host"); } if (sessionToExamine.hostname != sessionOut.hostname) { fail = true; Console.WriteLine("hostname"); } // fiddler static inc if (sessionToExamine.id != sessionOut.id) Console.WriteLine("id"); if (sessionToExamine.isFTP != sessionOut.isFTP) { fail = true; Console.WriteLine("isFTP"); } if (sessionToExamine.isHTTPS != sessionOut.isHTTPS) { fail = true; Console.WriteLine("isHTTPS"); } if (sessionToExamine.isTunnel != sessionOut.isTunnel) { fail = true; Console.WriteLine("isTunnel"); } if (sessionToExamine.port != sessionOut.port) { fail = true; Console.WriteLine("port"); } if (!CompareByteArrays(sessionToExamine.requestBodyBytes, sessionOut.requestBodyBytes, "requestBodyBytes")) { fail = true; Console.WriteLine("requestBodyBytes"); Console.WriteLine("--------------------------------------------------------"); Console.WriteLine(Encoding.UTF8.GetString(sessionToExamine.requestBodyBytes)); Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); Console.WriteLine(Encoding.UTF8.GetString(sessionOut.requestBodyBytes)); Console.WriteLine("--------------------------------------------------------"); } if (!CompareByteArrays(sessionToExamine.responseBodyBytes, sessionOut.responseBodyBytes, "responseBodyBytes")) { fail = true; Console.WriteLine("responseBodyBytes"); Console.WriteLine("--------------------------------------------------------"); Console.WriteLine(Encoding.UTF8.GetString(sessionToExamine.responseBodyBytes)); Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"); Console.WriteLine(Encoding.UTF8.GetString(sessionOut.responseBodyBytes)); Console.WriteLine("--------------------------------------------------------"); } if (sessionToExamine.responseCode != sessionOut.responseCode) { fail = true; Console.WriteLine("responseCode"); } if (sessionToExamine.state != sessionOut.state) { fail = true; Console.WriteLine("state"); } if (sessionToExamine.url != sessionOut.url) { fail = true; Console.WriteLine("url"); } // not tx if (sessionToExamine.clientIP != sessionOut.clientIP) Console.WriteLine("clientIP"); // not tx if (sessionToExamine.clientPort != sessionOut.clientPort) Console.WriteLine("clientPort"); // not tx if (sessionToExamine.m_clientIP != sessionOut.m_clientIP) Console.WriteLine("m_clientIP"); // not tx if (sessionToExamine.m_clientPort != sessionOut.m_clientPort) Console.WriteLine("m_clientPort"); // not tx ?? if (sessionToExamine.m_hostIP != sessionOut.m_hostIP) Console.WriteLine("m_hostIP"); // #TODO: compare hashtables //if (sessionToExamine.oFlags != sessionOut.oFlags) Console.WriteLine("oFlags"); // object comparison if (sessionToExamine.oRequest != sessionOut.oRequest) Console.WriteLine("oRequest"); // object comparison if (sessionToExamine.oResponse != sessionOut.oResponse) Console.WriteLine("oResponse"); //#TODO check export "!string.IsNullOrEmpty(session["ui-comments"]) //if (sessionToExamine.BitFlags != sessionOut.BitFlags) Console.WriteLine("BitFlags"); //if (sessionToExamine.LocalProcessID != sessionOut.LocalProcessID) Console.WriteLine("LocalProcessID"); Assert.False(fail, "round trip failed"); } catch (Exception ex) { Assert.Fail(ex.Message); } finally { p.Stop(); } }
public void RemoveMedia() { _tape = null; }
public void Insert(Tape tape) { _tape = tape; }