microsoft / microsoft/onnxruntime

Not getting even near accurate results trying to make a identity function using convolution node

Open
#20,221 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 11h
Merged PRs (30d)
184

Description

### Describe the feature request

def idenity(shape):
input_tensor = onnx.helper.make_tensor_value_info('input_tensor',onnx.TensorProto.FLOAT,input_shape)
output = onnx.helper.make_tensor_value_info('output',onnx.TensorProto.FLOAT,['N','C','H','W'])
kernel1_val = (np.eye(input_shape[1]).astype(np.float32)).flatten()
kernel = onnx.helper.make_tensor('kernel',onnx.TensorProto.FLOAT,[input_shape[1],input_shape[1],1,1],kernel1_val)
bias = onnx.helper.make_tensor('bias',onnx.TensorProto.FLOAT,[1],[0.0])
iden_node = onnx.helper.make_node('Conv',inputs=["input_tensor","kernel","bias"],outputs=["output"],kernel_shape = [1,1],pads = [0,0,0,0],strides=[1,1],group=1,name="identity_conv")
graph = onnx.helper.make_graph(nodes=[iden_node],name='identity',inputs=[input_tensor],outputs=[output],initializer=[kernel,bias])
return graph
#this is a identity convolution which I used instead of direct identity node

### Describe scenario use case

I have taken a more than 500+ sample of input tensors with different channels and dimensions and random values when I compare the input and output after each iteration during the start input and output with shape and value tensors are equal after 5 to 10 iterations the output tensors where giving "nan" the shape is same as the input tensor
```[tasklist]
### Tasks
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file, test, runtime version, or complete reproducer is identified. Start by reproducing the reported identity Conv graph with the 500+ random tensor cases and compare values across iterations, then trace where NaNs first appear. Done means the cause is isolated and a regression test or precise reproducible diagnosis is recorded.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.