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

If there is many inputs, how to write input? #59

Open
FanShuixing opened this issue Mar 13, 2020 · 6 comments
Open

If there is many inputs, how to write input? #59

FanShuixing opened this issue Mar 13, 2020 · 6 comments

Comments

@FanShuixing
Copy link

Thanks for your work.I know the normal usage is tw.draw_model(model,[1,3,224,224]).However,If the model has many inputs,what is the right style? I have tried tw.draw_model(model,([input1],[input2])) and tw.draw_model(model,[[input1],[input2]]) ,no one is right.
can tw.draw_model only draw models for only one input? Or There is something wrong in my using?Sincerely for your reply.

@cloudpanl
Copy link

I also have the same needs. Is it solved?

@StrugglingForBetter
Copy link

Is there anybody who can hlep use with this issue?

@violetcodet
Copy link

Same question,

@AlphaGoMK
Copy link

AlphaGoMK commented Oct 5, 2020

Hey guys, I may solve this problem by input a composed tensor and split it into several inputs before the forward process begin.
Like call tensorwatch by tw.draw_model(model, [2,1,3,224,224]), and add torch.split in forward function of your model, which split tensor([2,1,3,224,224]) into tensor([1,3,224,224]) and tensor([1,3,224,224])

@StrugglingForBetter
Copy link

Hey guys, I may solve this problem by input a composed tensor and split it into several inputs before the forward process begin.
Like call tensorwatch by tw.draw_model(model, [2,1,3,224,224]), and add torch.split in forward function of your model, which split tensor([2,1,3,224,224]) into tensor([1,3,224,224]) and tensor([1,3,224,224])

What if we need two inputs with different shape? For example, if our inputs are [1, 3, 224, 224] and [1, 3, 112, 112]?

@AlphaGoMK
Copy link

Hey guys, I may solve this problem by input a composed tensor and split it into several inputs before the forward process begin.
Like call tensorwatch by tw.draw_model(model, [2,1,3,224,224]), and add torch.split in forward function of your model, which split tensor([2,1,3,224,224]) into tensor([1,3,224,224]) and tensor([1,3,224,224])

What if we need two inputs with different shape? For example, if our inputs are [1, 3, 224, 224] and [1, 3, 112, 112]?

Just input [1, 15, 112, 112], then divide it into [1, 12, 112, 112] and [1, 3, 112, 112] along the second dimension. The first tensor can be reshaped/viewed to [1, 3, 224, 224] as you need.

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

5 participants