mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-29 03:00:14 -04:00
hotfix: viz recenter and unlimited zoom (#9760)
* hotfix: viz recenter and unlimited zoom * add shapes to the ast graph * not for COPY
This commit is contained in:
@@ -190,7 +190,7 @@ function renderMemoryGraph(graph) {
|
||||
|
||||
// ** zoom and recentering
|
||||
|
||||
const zoom = d3.zoom().scaleExtent([0.05, 2]).on("zoom", (e) => d3.select("#render").attr("transform", e.transform));
|
||||
const zoom = d3.zoom().on("zoom", (e) => d3.select("#render").attr("transform", e.transform));
|
||||
d3.select("#graph-svg").call(zoom);
|
||||
// zoom to fit into view
|
||||
document.getElementById("zoom-to-fit-btn").addEventListener("click", () => {
|
||||
@@ -426,6 +426,7 @@ document.addEventListener("keydown", async function(event) {
|
||||
return setState({ currentRewrite:Math.min(totalRewrites, currentRewrite+1) });
|
||||
}
|
||||
if (event.key == " ") {
|
||||
event.preventDefault()
|
||||
document.getElementById("zoom-to-fit-btn").click();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -71,6 +71,7 @@ def uop_to_json(x:UOp) -> dict[int, dict]:
|
||||
if x in excluded:
|
||||
if x.op is Ops.CONST and dtypes.is_float(u.dtype): label += f"\nCONST{idx} {x.arg:g}"
|
||||
else: label += f"\n{x.op.name}{idx} {x.arg}"
|
||||
if u.op not in {Ops.VIEW, Ops.BUFFER, Ops.KERNEL, Ops.ASSIGN, Ops.COPY, *GroupOp.Buffer} and u.st is not None: label += f"\n{repr(u.shape)}"
|
||||
graph[id(u)] = {"label":label, "src":[id(x) for x in u.src if x not in excluded], "color":uops_colors.get(u.op, "#ffffff")}
|
||||
return graph
|
||||
|
||||
|
||||
Reference in New Issue
Block a user