Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to adjust the resolution of the saved dot image? #41

Open
Jian-danai opened this issue Mar 28, 2020 · 2 comments
Open

How to adjust the resolution of the saved dot image? #41

Jian-danai opened this issue Mar 28, 2020 · 2 comments

Comments

@Jian-danai
Copy link

Jian-danai commented Mar 28, 2020

How to adjust the resolution of the saved dot image?
My computational graph is too long...then the image seems not clear enough.
image

@ucalyptus
Copy link

@Jian-danai very easy

def resize_graph(dot, size_per_element=0.15, min_size=12):
    """Resize the graph according to how much content it contains.
    Modify the graph in place.
    """
    # Get the approximate number of nodes and edges
    num_rows = len(dot.body)
    content_size = num_rows * size_per_element
    size = max(min_size, content_size)
    size_str = str(size) + "," + str(size)
    dot.graph_attr.update(size=size_str)


resize_graph(dot,size_per_element=1,min_size=20)
dot.format = 'png'
dot.render('hehe')

@mkmohangb
Copy link

Use svg format:

output  = model(inputs)
dot = make_dot(output).render("filename", format="svg")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants