Shapes of intermediate tensors
See original GitHub issueAsk a Question
Question
In a onnx graph, I can see the tensor shapes for the inputs and outputs. Is there a way to know what shapes the intermediate tensors are? I consulted the shape inferencing document but it looks like there is only a c++ api.
Further information
- Relevant Area: shape_inference
Notes
Model exported from pytorch
import torch
from torch import nn
class Upsampling(nn.Module):
def __init__(self):
super().__init__()
self.upsample = nn.Upsample(size=[2,2], mode='nearest')
def forward(self, input, weight):
weight = self.upsample(weight)
return torch.nn.functional.conv2d(input, weight)
torch.onnx.export(Upsampling(), (torch.tensor([[[[1,2],[1,2]]]], dtype=torch.float32), torch.tensor([[[[1]]]], dtype=torch.float32)), "test.onnx")
Issue Analytics
- State:
- Created a year ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Rank, Axes, and Shape Explained - Tensors for Deep Learning
The rank, axes, and shape are three tensor attributes that will concern us most when starting out with tensors in deep learning.
Read more >Printing intermediate tensors during training - Stack Overflow
I am having a custom layer and I want to print the intermediate tensors which are not linked to the returned tensor(shown in...
Read more >Introduction to PyTorch Tensors
Tensors are the central data abstraction in PyTorch. This interactive notebook provides an in-depth introduction to the torch.Tensor class.
Read more >Is it possible to start TensorFlow from an intermediate layer?
Received: inputs=Tensor("up_sampling2d_2/resize/ResizeNearestNeighbor:0", shape=(1, 26, 26, 128), dtype=float32) (not a list of tensors).
Read more >Intermediate Losses — TextBrewer 0.2.1.post1 documentation
If the inputs_mask is given, masks the positions where input_mask==0 . Parameters. logits_S (torch.Tensor) – tensor of shape ( ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
After offline discussion, we found that actually Resize is missing data propagation support so it cannot get shape information from previous Shape op. Then, I made a quick experiment and adding
ctx.getSymbolicInput()
in Resize op can indeed make it infer the right info. I will submit a PR for it when I have time. Thank you @justinchuby for catching this!~It needs the exact “tensor value” of input “sizes” for Resize, which comes from model.graph.input. The shape for the input “sizes” is not sufficient.~