Skip to content

Model having scatterND layer giving different result every time with same input #23396

Open
@beinggourav

Description

Describe the issue

Model has scatterND layer with add reduction, using all zeros for data input, random input for updates. I have fixed seed also so that every time I get same input from np.random
I am getting different result in every run with same input.

To reproduce

Attached the model, run below code to get output. Run multiple times to see difference in each run

import onnxruntime
import numpy as np

def run(sess):
  input_details = sess.get_inputs()
  input_dict = {}

  for i in range(len(input_details)):
    np.random.seed(0)
    if(input_details[i].type == 'tensor(float)'):
        input_data = np.random.randn(*input_details[i].shape).astype(np.float32)

    if(input_details[i].name == "bev_feat"):
        input_data = np.zeros(input_details[i].shape).astype(np.float32)
    elif(input_details[i].name == "/Unsqueeze_2_output_0"):
        input_data = np.random.randint(100, size=(input_details[i].shape)).astype(np.int64)

    input_dict[input_details[i].name] = input_data
    print(input_details[i].name, input_data[0][:10])

  output = list(sess.run(None, input_dict))
  return output

EP_list = ['CPUExecutionProvider']
sess = onnxruntime.InferenceSession("<model_path_here>", providers=EP_list)
output = run(sess)
print("\nOutput:", output[0][0][:10])

Urgency

Yes, stuck at this point. I need a reference of actual onnx output for my scatterND implementation.

Platform

Linux

OS Version

Ubuntu 22.04.3 LTS

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

1.15.0

ONNX Runtime API

Python

Architecture

X86

Execution Provider

Default CPU

Execution Provider Library Version

No response

Model File

testing_model.zip

Is this a quantized model?

No

Metadata

Assignees

No one assigned

    Labels

    performanceissues related to performance regressions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions