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

feat: explainer support pdf #27

Merged
merged 1 commit into from Sep 20, 2021
Merged

feat: explainer support pdf #27

merged 1 commit into from Sep 20, 2021

Conversation

sbrugman
Copy link
Contributor

Enable PDF (and other supported formats) savefig in explainer by removing hardcoded extension

import torch
W = torch.rand(d,n_neurons)
b = torch.rand(n_neurons,1)
X = torch.rand(n,d)
with ts.explain(savefig="my_inspection.pdf"):
    Y = W @ X.T + b

Enable PDF (and other supported formats) savefig in explainer by removing hardcoded extension

```
import torch
W = torch.rand(d,n_neurons)
b = torch.rand(n_neurons,1)
X = torch.rand(n,d)
with ts.explain(savefig="my_inspection.pdf"):
    Y = W @ X.T + b
```
@parrt
Copy link
Owner

parrt commented Sep 20, 2021

Hi. I can't remember why but something prevented me from allowing non-svg. Hmm...let me look.

@parrt parrt added the enhancement New feature or request label Sep 20, 2021
@parrt
Copy link
Owner

parrt commented Sep 20, 2021

ok, looks good. We only save with plt.savefig() in one spot, PyVizView.savefig(), so should be safe to allow any extensions. thanks!

@parrt parrt merged commit 6b29954 into parrt:master Sep 20, 2021
@sbrugman sbrugman deleted the patch-1 branch September 20, 2021 21:40
@parrt
Copy link
Owner

parrt commented Sep 20, 2021

Confirmed that this works with pdf now:

import torch
import tsensor

n = 100
d = 10
n_neurons = 100
W = torch.rand(d,n_neurons)
b = torch.rand(n_neurons,1)
X = torch.rand(n,d)
with tsensor.explain(savefig="my_inspection.pdf"):
    Y = W @ X.T + b

@parrt parrt added this to the 0.1.3 milestone Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants