tensorwatch icon indicating copy to clipboard operation
tensorwatch copied to clipboard

If there is many inputs, how to write input?

Open FanShuixing opened this issue 5 years ago • 6 comments

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.

FanShuixing avatar Mar 13 '20 04:03 FanShuixing

I also have the same needs. Is it solved?

cloudpanl avatar Jun 18 '20 03:06 cloudpanl

Is there anybody who can hlep use with this issue?

StrugglingForBetter avatar Jul 20 '20 12:07 StrugglingForBetter

Same question,

violetcodet avatar Aug 03 '20 10:08 violetcodet

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])

AlphaGoMK avatar Oct 05 '20 14:10 AlphaGoMK

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]?

StrugglingForBetter avatar Oct 06 '20 00:10 StrugglingForBetter

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.

AlphaGoMK avatar Oct 06 '20 02:10 AlphaGoMK