diff --git a/.travis.yml b/.travis.yml index 35b08ae1..234dab55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: go sudo: false go: - - 1.13.x + - 1.14.x before_install: - make install diff --git a/backend/testbackend/onnx/doc.go b/backend/testbackend/onnx/doc.go deleted file mode 100644 index bd8cea52..00000000 --- a/backend/testbackend/onnx/doc.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package onnxtest contains an export of the onnx test files -package onnxtest diff --git a/backend/testbackend/onnx/gen_cmd/generate.go b/backend/testbackend/onnx/gen_cmd/generate.go index a140c2f8..e0fe1c9b 100644 --- a/backend/testbackend/onnx/gen_cmd/generate.go +++ b/backend/testbackend/onnx/gen_cmd/generate.go @@ -14,6 +14,8 @@ import ( "strings" "text/template" + "github.com/kr/pretty" + "github.com/davecgh/go-spew/spew" "github.com/owulveryck/onnx-go/internal/onnx/ir" ) @@ -90,6 +92,7 @@ func processFile(file os.FileInfo) (string, string, error) { if err != nil { return "", "", err } + tv.Dump = fmt.Sprintf("%# v", pretty.Formatter(model)) tv.Description = fmt.Sprintf("version: %v. %v", model.GetIrVersion(), model.GetDocString()) mv.TestName = fmt.Sprintf("%#v", file.Name()) mv.IrVersion = fmt.Sprintf("%v", model.IrVersion) @@ -207,7 +210,7 @@ func processModelGraphNodeInput(filename string, node *ir.NodeProto, tv *testVal tv.Input = make([]iO, len(node.GetInput())) for i := range node.GetInput() { // Open the tensorproto sample file - filepath := fmt.Sprintf("%v%v/test_data_set_0/input_%v.ir", *testdir, filename, i) + filepath := fmt.Sprintf("%v%v/test_data_set_0/input_%v.pb", *testdir, filename, i) b, err := ioutil.ReadFile(filepath) if err != nil { return err @@ -243,7 +246,7 @@ func processModelGraphNodeOutput(filename string, node *ir.NodeProto, tv *testVa tv.ExpectedOutput = make([]iO, len(node.GetOutput())) for i := range node.Output { // Open the tensorproto sample file - filepath := fmt.Sprintf("%v%v/test_data_set_0/output_%v.ir", *testdir, filename, i) + filepath := fmt.Sprintf("%v%v/test_data_set_0/output_%v.pb", *testdir, filename, i) b, err := ioutil.ReadFile(filepath) if err != nil { return err diff --git a/backend/testbackend/onnx/gen_cmd/test_template.go b/backend/testbackend/onnx/gen_cmd/test_template.go index 008e35ed..2068017a 100644 --- a/backend/testbackend/onnx/gen_cmd/test_template.go +++ b/backend/testbackend/onnx/gen_cmd/test_template.go @@ -6,6 +6,7 @@ var testTemplate = template.Must(template.New("testCase").Parse(testTmpl)) var testTestTemplate = template.Must(template.New("testTestCase").Parse(testTestTmpl)) type testValue struct { + Dump string OpType string TestName string Description string @@ -101,6 +102,9 @@ func init() { testbackend.Register("{{ .OpType }}","{{ .TestName }}",New{{ .TestName }}) } +/* +{{ .Dump }} +*/ // New{{ .TestName }} {{ .Description }} func New{{ .TestName }}() *testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_abs.go b/backend/testbackend/onnx/onnx_test_abs.go index 76c61134..cd39dd89 100644 --- a/backend/testbackend/onnx/onnx_test_abs.go +++ b/backend/testbackend/onnx/onnx_test_abs.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Abs", "TestAbs", NewTestAbs) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Abs", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_abs", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAbs version: 3. func NewTestAbs() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_acos.go b/backend/testbackend/onnx/onnx_test_acos.go index afc84157..0d9d6b33 100644 --- a/backend/testbackend/onnx/onnx_test_acos.go +++ b/backend/testbackend/onnx/onnx_test_acos.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Acos", "TestAcos", NewTestAcos) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Acos", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_acos", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAcos version: 3. func NewTestAcos() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_acos_example.go b/backend/testbackend/onnx/onnx_test_acos_example.go index a5e70bce..f487a72d 100644 --- a/backend/testbackend/onnx/onnx_test_acos_example.go +++ b/backend/testbackend/onnx/onnx_test_acos_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Acos", "TestAcosExample", NewTestAcosExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Acos", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_acos_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAcosExample version: 3. func NewTestAcosExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_acosh.go b/backend/testbackend/onnx/onnx_test_acosh.go index cbfdcb94..19c478c5 100644 --- a/backend/testbackend/onnx/onnx_test_acosh.go +++ b/backend/testbackend/onnx/onnx_test_acosh.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Acosh", "TestAcosh", NewTestAcosh) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Acosh", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_acosh", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAcosh version: 3. func NewTestAcosh() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_acosh_example.go b/backend/testbackend/onnx/onnx_test_acosh_example.go index 0ffa24ad..bb445400 100644 --- a/backend/testbackend/onnx/onnx_test_acosh_example.go +++ b/backend/testbackend/onnx/onnx_test_acosh_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Acosh", "TestAcoshExample", NewTestAcoshExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Acosh", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_acosh_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAcoshExample version: 3. func NewTestAcoshExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_add.go b/backend/testbackend/onnx/onnx_test_add.go index 9ce2c83d..2ad3c4f8 100644 --- a/backend/testbackend/onnx/onnx_test_add.go +++ b/backend/testbackend/onnx/onnx_test_add.go @@ -11,6 +11,128 @@ func init() { testbackend.Register("Add", "TestAdd", NewTestAdd) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"sum"}, + Name: "", + OpType: "Add", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_add", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "sum", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAdd version: 3. func NewTestAdd() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_add_bcast.go b/backend/testbackend/onnx/onnx_test_add_bcast.go index 93ac5bf0..d9c15807 100644 --- a/backend/testbackend/onnx/onnx_test_add_bcast.go +++ b/backend/testbackend/onnx/onnx_test_add_bcast.go @@ -11,6 +11,120 @@ func init() { testbackend.Register("Add", "TestAddBcast", NewTestAddBcast) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"sum"}, + Name: "", + OpType: "Add", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_add_bcast", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "sum", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAddBcast version: 3. func NewTestAddBcast() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_argmax_default_axis_example.go b/backend/testbackend/onnx/onnx_test_argmax_default_axis_example.go index 7ffd3ec4..31684318 100644 --- a/backend/testbackend/onnx/onnx_test_argmax_default_axis_example.go +++ b/backend/testbackend/onnx/onnx_test_argmax_default_axis_example.go @@ -11,6 +11,111 @@ func init() { testbackend.Register("ArgMax", "TestArgmaxDefaultAxisExample", NewTestArgmaxDefaultAxisExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmax_default_axis_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestArgmaxDefaultAxisExample version: 3. func NewTestArgmaxDefaultAxisExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +131,7 @@ func NewTestArgmaxDefaultAxisExample() *testbackend.TestCase { Name: "", OpType: "ArgMax", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126800)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0001e6700)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_argmax_default_axis_example_select_last_index.go b/backend/testbackend/onnx/onnx_test_argmax_default_axis_example_select_last_index.go new file mode 100644 index 00000000..8c788698 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_default_axis_example_select_last_index.go @@ -0,0 +1,176 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMax", "TestArgmaxDefaultAxisExampleSelectLastIndex", NewTestArgmaxDefaultAxisExampleSelectLastIndex) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "select_last_index", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmax_default_axis_example_select_last_index", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgmaxDefaultAxisExampleSelectLastIndex version: 6. +func NewTestArgmaxDefaultAxisExampleSelectLastIndex() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMax", + Title: "TestArgmaxDefaultAxisExampleSelectLastIndex", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xa9, 0x1, 0xa, 0x41, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x61, 0x78, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0x18, 0xa, 0x11, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x32, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x18, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMax", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000216c00)(name:"keepdims" type:INT i:1 ), + (*ir.AttributeProto)(0xc000216d00)(name:"select_last_index" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{2, 2, 3, 10}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 2), + tensor.WithBacking([]int64{1, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_default_axis_example_select_last_index_test.go b/backend/testbackend/onnx/onnx_test_argmax_default_axis_example_select_last_index_test.go new file mode 100644 index 00000000..b3698819 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_default_axis_example_select_last_index_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgmaxDefaultAxisExampleSelectLastIndex(t *testing.T) { + mytest := NewTestArgmaxDefaultAxisExampleSelectLastIndex() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_default_axis_random.go b/backend/testbackend/onnx/onnx_test_argmax_default_axis_random.go index 75dde505..869f4a5d 100644 --- a/backend/testbackend/onnx/onnx_test_argmax_default_axis_random.go +++ b/backend/testbackend/onnx/onnx_test_argmax_default_axis_random.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ArgMax", "TestArgmaxDefaultAxisRandom", NewTestArgmaxDefaultAxisRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmax_default_axis_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestArgmaxDefaultAxisRandom version: 3. func NewTestArgmaxDefaultAxisRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestArgmaxDefaultAxisRandom() *testbackend.TestCase { Name: "", OpType: "ArgMax", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000350300)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0001e6400)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_argmax_default_axis_random_select_last_index.go b/backend/testbackend/onnx/onnx_test_argmax_default_axis_random_select_last_index.go new file mode 100644 index 00000000..c7680194 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_default_axis_random_select_last_index.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMax", "TestArgmaxDefaultAxisRandomSelectLastIndex", NewTestArgmaxDefaultAxisRandomSelectLastIndex) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "select_last_index", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmax_default_axis_random_select_last_index", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgmaxDefaultAxisRandomSelectLastIndex version: 6. +func NewTestArgmaxDefaultAxisRandomSelectLastIndex() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMax", + Title: "TestArgmaxDefaultAxisRandomSelectLastIndex", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xb0, 0x1, 0xa, 0x41, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x61, 0x78, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0x18, 0xa, 0x11, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x31, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x62, 0x1c, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x7, 0x12, 0xc, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMax", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000216b00)(name:"keepdims" type:INT i:1 ), + (*ir.AttributeProto)(0xc000216c00)(name:"select_last_index" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984, 1.3608912, 8.511932, -8.579279, -8.257414, -9.595632, 6.6523967, 5.563135, 7.400243, 9.572367, 5.9831715, -0.77041274, 5.6105833}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 3, 4), + tensor.WithBacking([]int64{1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_default_axis_random_select_last_index_test.go b/backend/testbackend/onnx/onnx_test_argmax_default_axis_random_select_last_index_test.go new file mode 100644 index 00000000..20cf7cc0 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_default_axis_random_select_last_index_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgmaxDefaultAxisRandomSelectLastIndex(t *testing.T) { + mytest := NewTestArgmaxDefaultAxisRandomSelectLastIndex() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_keepdims_example.go b/backend/testbackend/onnx/onnx_test_argmax_keepdims_example.go index f837c65a..58428c9b 100644 --- a/backend/testbackend/onnx/onnx_test_argmax_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_argmax_keepdims_example.go @@ -11,6 +11,129 @@ func init() { testbackend.Register("ArgMax", "TestArgmaxKeepdimsExample", NewTestArgmaxKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmax_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestArgmaxKeepdimsExample version: 3. func NewTestArgmaxKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +149,8 @@ func NewTestArgmaxKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ArgMax", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000350400)(name:"axis" type:INT i:1 ), - (*ir.AttributeProto)(0xc000350500)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217200)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217300)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_argmax_keepdims_example_select_last_index.go b/backend/testbackend/onnx/onnx_test_argmax_keepdims_example_select_last_index.go new file mode 100644 index 00000000..43c57cdb --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_keepdims_example_select_last_index.go @@ -0,0 +1,195 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMax", "TestArgmaxKeepdimsExampleSelectLastIndex", NewTestArgmaxKeepdimsExampleSelectLastIndex) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "select_last_index", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmax_keepdims_example_select_last_index", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgmaxKeepdimsExampleSelectLastIndex version: 6. +func NewTestArgmaxKeepdimsExampleSelectLastIndex() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMax", + Title: "TestArgmaxKeepdimsExampleSelectLastIndex", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xb2, 0x1, 0xa, 0x4e, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x61, 0x78, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0x18, 0xa, 0x11, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x61, 0x78, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x18, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMax", + Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { + (*ir.AttributeProto)(0xc000217600)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217700)(name:"keepdims" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217800)(name:"select_last_index" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{2, 2, 3, 10}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 1), + tensor.WithBacking([]int64{1, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_keepdims_example_select_last_index_test.go b/backend/testbackend/onnx/onnx_test_argmax_keepdims_example_select_last_index_test.go new file mode 100644 index 00000000..a015f4e6 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_keepdims_example_select_last_index_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgmaxKeepdimsExampleSelectLastIndex(t *testing.T) { + mytest := NewTestArgmaxKeepdimsExampleSelectLastIndex() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_keepdims_random.go b/backend/testbackend/onnx/onnx_test_argmax_keepdims_random.go index 8ee09e68..102dc967 100644 --- a/backend/testbackend/onnx/onnx_test_argmax_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_argmax_keepdims_random.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ArgMax", "TestArgmaxKeepdimsRandom", NewTestArgmaxKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmax_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestArgmaxKeepdimsRandom version: 3. func NewTestArgmaxKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestArgmaxKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ArgMax", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000126e00)(name:"axis" type:INT i:1 ), - (*ir.AttributeProto)(0xc000126f00)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217a00)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217b00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_argmax_keepdims_random_select_last_index.go b/backend/testbackend/onnx/onnx_test_argmax_keepdims_random_select_last_index.go new file mode 100644 index 00000000..359fac18 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_keepdims_random_select_last_index.go @@ -0,0 +1,203 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMax", "TestArgmaxKeepdimsRandomSelectLastIndex", NewTestArgmaxKeepdimsRandomSelectLastIndex) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "select_last_index", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmax_keepdims_random_select_last_index", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgmaxKeepdimsRandomSelectLastIndex version: 6. +func NewTestArgmaxKeepdimsRandomSelectLastIndex() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMax", + Title: "TestArgmaxKeepdimsRandomSelectLastIndex", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xb9, 0x1, 0xa, 0x4e, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x61, 0x78, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0x18, 0xa, 0x11, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x61, 0x78, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x62, 0x1c, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x7, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMax", + Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { + (*ir.AttributeProto)(0xc000217f00)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc00039e000)(name:"keepdims" type:INT i:1 ), + (*ir.AttributeProto)(0xc00039e100)(name:"select_last_index" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984, 1.3608912, 8.511932, -8.579279, -8.257414, -9.595632, 6.6523967, 5.563135, 7.400243, 9.572367, 5.9831715, -0.77041274, 5.6105833}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 1, 4), + tensor.WithBacking([]int64{2, 0, 2, 1, 2, 0, 1, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_keepdims_random_select_last_index_test.go b/backend/testbackend/onnx/onnx_test_argmax_keepdims_random_select_last_index_test.go new file mode 100644 index 00000000..a0507f2f --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_keepdims_random_select_last_index_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgmaxKeepdimsRandomSelectLastIndex(t *testing.T) { + mytest := NewTestArgmaxKeepdimsRandomSelectLastIndex() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_example.go b/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_example.go new file mode 100644 index 00000000..9ebacfdd --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_example.go @@ -0,0 +1,176 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMax", "TestArgmaxNegativeAxisKeepdimsExample", NewTestArgmaxNegativeAxisKeepdimsExample) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmax_negative_axis_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgmaxNegativeAxisKeepdimsExample version: 6. +func NewTestArgmaxNegativeAxisKeepdimsExample() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMax", + Title: "TestArgmaxNegativeAxisKeepdimsExample", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x9d, 0x1, 0xa, 0x3d, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x61, 0x78, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2a, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x61, 0x78, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x18, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMax", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc00039e400)(name:"axis" type:INT i:-1 ), + (*ir.AttributeProto)(0xc00039e500)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{2, 1, 3, 10}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 1), + tensor.WithBacking([]int64{0, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_example_select_last_index.go b/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_example_select_last_index.go new file mode 100644 index 00000000..467d9852 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_example_select_last_index.go @@ -0,0 +1,195 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMax", "TestArgmaxNegativeAxisKeepdimsExampleSelectLastIndex", NewTestArgmaxNegativeAxisKeepdimsExampleSelectLastIndex) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "select_last_index", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmax_negative_axis_keepdims_example_select_last_index", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgmaxNegativeAxisKeepdimsExampleSelectLastIndex version: 6. +func NewTestArgmaxNegativeAxisKeepdimsExampleSelectLastIndex() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMax", + Title: "TestArgmaxNegativeAxisKeepdimsExampleSelectLastIndex", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xc9, 0x1, 0xa, 0x57, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x61, 0x78, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0x18, 0xa, 0x11, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x3c, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x61, 0x78, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x18, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMax", + Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { + (*ir.AttributeProto)(0xc000216b00)(name:"axis" type:INT i:-1 ), + (*ir.AttributeProto)(0xc000216c00)(name:"keepdims" type:INT i:1 ), + (*ir.AttributeProto)(0xc000216d00)(name:"select_last_index" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{2, 2, 3, 10}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 1), + tensor.WithBacking([]int64{1, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_example_select_last_index_test.go b/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_example_select_last_index_test.go new file mode 100644 index 00000000..d509e9e6 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_example_select_last_index_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgmaxNegativeAxisKeepdimsExampleSelectLastIndex(t *testing.T) { + mytest := NewTestArgmaxNegativeAxisKeepdimsExampleSelectLastIndex() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_example_test.go b/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_example_test.go new file mode 100644 index 00000000..e9fd33c4 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_example_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgmaxNegativeAxisKeepdimsExample(t *testing.T) { + mytest := NewTestArgmaxNegativeAxisKeepdimsExample() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_random.go b/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_random.go new file mode 100644 index 00000000..4663aa3d --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_random.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMax", "TestArgmaxNegativeAxisKeepdimsRandom", NewTestArgmaxNegativeAxisKeepdimsRandom) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmax_negative_axis_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgmaxNegativeAxisKeepdimsRandom version: 6. +func NewTestArgmaxNegativeAxisKeepdimsRandom() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMax", + Title: "TestArgmaxNegativeAxisKeepdimsRandom", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xa4, 0x1, 0xa, 0x3d, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x61, 0x78, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x29, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x61, 0x78, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x62, 0x1c, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x7, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMax", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000216f00)(name:"axis" type:INT i:-1 ), + (*ir.AttributeProto)(0xc000217000)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984, 1.3608912, 8.511932, -8.579279, -8.257414, -9.595632, 6.6523967, 5.563135, 7.400243, 9.572367, 5.9831715, -0.77041274, 5.6105833}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 1), + tensor.WithBacking([]int64{1, 3, 0, 1, 3, 0}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_random_select_last_index.go b/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_random_select_last_index.go new file mode 100644 index 00000000..497003f4 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_random_select_last_index.go @@ -0,0 +1,203 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMax", "TestArgmaxNegativeAxisKeepdimsRandomSelectLastIndex", NewTestArgmaxNegativeAxisKeepdimsRandomSelectLastIndex) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "select_last_index", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmax_negative_axis_keepdims_random_select_last_index", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgmaxNegativeAxisKeepdimsRandomSelectLastIndex version: 6. +func NewTestArgmaxNegativeAxisKeepdimsRandomSelectLastIndex() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMax", + Title: "TestArgmaxNegativeAxisKeepdimsRandomSelectLastIndex", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xd0, 0x1, 0xa, 0x57, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x61, 0x78, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0x18, 0xa, 0x11, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x3b, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x61, 0x78, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x62, 0x1c, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x7, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMax", + Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { + (*ir.AttributeProto)(0xc000217400)(name:"axis" type:INT i:-1 ), + (*ir.AttributeProto)(0xc000217500)(name:"keepdims" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217600)(name:"select_last_index" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984, 1.3608912, 8.511932, -8.579279, -8.257414, -9.595632, 6.6523967, 5.563135, 7.400243, 9.572367, 5.9831715, -0.77041274, 5.6105833}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 1), + tensor.WithBacking([]int64{1, 3, 0, 1, 3, 0}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_random_select_last_index_test.go b/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_random_select_last_index_test.go new file mode 100644 index 00000000..93b00e5e --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_random_select_last_index_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgmaxNegativeAxisKeepdimsRandomSelectLastIndex(t *testing.T) { + mytest := NewTestArgmaxNegativeAxisKeepdimsRandomSelectLastIndex() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_random_test.go b/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_random_test.go new file mode 100644 index 00000000..a5f14982 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_negative_axis_keepdims_random_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgmaxNegativeAxisKeepdimsRandom(t *testing.T) { + mytest := NewTestArgmaxNegativeAxisKeepdimsRandom() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_example.go b/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_example.go index af95ab4e..95681fdd 100644 --- a/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_example.go @@ -11,6 +11,125 @@ func init() { testbackend.Register("ArgMax", "TestArgmaxNoKeepdimsExample", NewTestArgmaxNoKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmax_no_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestArgmaxNoKeepdimsExample version: 3. func NewTestArgmaxNoKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +145,8 @@ func NewTestArgmaxNoKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ArgMax", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000127400)(name:"axis" type:INT i:1 ), - (*ir.AttributeProto)(0xc000127500)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc000217900)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217a00)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_example_select_last_index.go b/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_example_select_last_index.go new file mode 100644 index 00000000..5426dc7d --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_example_select_last_index.go @@ -0,0 +1,191 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMax", "TestArgmaxNoKeepdimsExampleSelectLastIndex", NewTestArgmaxNoKeepdimsExampleSelectLastIndex) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "select_last_index", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmax_no_keepdims_example_select_last_index", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgmaxNoKeepdimsExampleSelectLastIndex version: 6. +func NewTestArgmaxNoKeepdimsExampleSelectLastIndex() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMax", + Title: "TestArgmaxNoKeepdimsExampleSelectLastIndex", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xb1, 0x1, 0xa, 0x4e, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x61, 0x78, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x0, 0xa0, 0x1, 0x2, 0x2a, 0x18, 0xa, 0x11, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x31, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x61, 0x78, 0x5f, 0x6e, 0x6f, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x14, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMax", + Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { + (*ir.AttributeProto)(0xc000217d00)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217e00)(name:"keepdims" type:INT ), + (*ir.AttributeProto)(0xc000217f00)(name:"select_last_index" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{2, 2, 3, 10}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2), + tensor.WithBacking([]int64{1, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_example_select_last_index_test.go b/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_example_select_last_index_test.go new file mode 100644 index 00000000..330dd776 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_example_select_last_index_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgmaxNoKeepdimsExampleSelectLastIndex(t *testing.T) { + mytest := NewTestArgmaxNoKeepdimsExampleSelectLastIndex() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_random.go b/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_random.go index 5d42d8b0..70ce4a1c 100644 --- a/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_random.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ArgMax", "TestArgmaxNoKeepdimsRandom", NewTestArgmaxNoKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmax_no_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestArgmaxNoKeepdimsRandom version: 3. func NewTestArgmaxNoKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestArgmaxNoKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ArgMax", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000350f00)(name:"axis" type:INT i:1 ), - (*ir.AttributeProto)(0xc000351000)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc0001e6400)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc0001e6500)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_random_select_last_index.go b/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_random_select_last_index.go new file mode 100644 index 00000000..3b95573e --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_random_select_last_index.go @@ -0,0 +1,199 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMax", "TestArgmaxNoKeepdimsRandomSelectLastIndex", NewTestArgmaxNoKeepdimsRandomSelectLastIndex) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "select_last_index", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmax_no_keepdims_random_select_last_index", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgmaxNoKeepdimsRandomSelectLastIndex version: 6. +func NewTestArgmaxNoKeepdimsRandomSelectLastIndex() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMax", + Title: "TestArgmaxNoKeepdimsRandomSelectLastIndex", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xb8, 0x1, 0xa, 0x4e, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x61, 0x78, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x0, 0xa0, 0x1, 0x2, 0x2a, 0x18, 0xa, 0x11, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x30, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x61, 0x78, 0x5f, 0x6e, 0x6f, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x62, 0x18, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMax", + Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { + (*ir.AttributeProto)(0xc000412100)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc000412200)(name:"keepdims" type:INT ), + (*ir.AttributeProto)(0xc000412300)(name:"select_last_index" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984, 1.3608912, 8.511932, -8.579279, -8.257414, -9.595632, 6.6523967, 5.563135, 7.400243, 9.572367, 5.9831715, -0.77041274, 5.6105833}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 4), + tensor.WithBacking([]int64{2, 0, 2, 1, 2, 0, 1, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_random_select_last_index_test.go b/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_random_select_last_index_test.go new file mode 100644 index 00000000..9193cbf7 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmax_no_keepdims_random_select_last_index_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgmaxNoKeepdimsRandomSelectLastIndex(t *testing.T) { + mytest := NewTestArgmaxNoKeepdimsRandomSelectLastIndex() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_default_axis_example.go b/backend/testbackend/onnx/onnx_test_argmin_default_axis_example.go index a7d5bcb1..e63d4b35 100644 --- a/backend/testbackend/onnx/onnx_test_argmin_default_axis_example.go +++ b/backend/testbackend/onnx/onnx_test_argmin_default_axis_example.go @@ -11,6 +11,111 @@ func init() { testbackend.Register("ArgMin", "TestArgminDefaultAxisExample", NewTestArgminDefaultAxisExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmin_default_axis_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestArgminDefaultAxisExample version: 3. func NewTestArgminDefaultAxisExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +131,7 @@ func NewTestArgminDefaultAxisExample() *testbackend.TestCase { Name: "", OpType: "ArgMin", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000351100)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000412600)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_argmin_default_axis_example_select_last_index.go b/backend/testbackend/onnx/onnx_test_argmin_default_axis_example_select_last_index.go new file mode 100644 index 00000000..8a0804d4 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_default_axis_example_select_last_index.go @@ -0,0 +1,176 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMin", "TestArgminDefaultAxisExampleSelectLastIndex", NewTestArgminDefaultAxisExampleSelectLastIndex) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "select_last_index", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmin_default_axis_example_select_last_index", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgminDefaultAxisExampleSelectLastIndex version: 6. +func NewTestArgminDefaultAxisExampleSelectLastIndex() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMin", + Title: "TestArgminDefaultAxisExampleSelectLastIndex", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xa9, 0x1, 0xa, 0x41, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x69, 0x6e, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0x18, 0xa, 0x11, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x32, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x18, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMin", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000412800)(name:"keepdims" type:INT i:1 ), + (*ir.AttributeProto)(0xc000412900)(name:"select_last_index" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{2, 2, 3, 10}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 2), + tensor.WithBacking([]int64{0, 0}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_default_axis_example_select_last_index_test.go b/backend/testbackend/onnx/onnx_test_argmin_default_axis_example_select_last_index_test.go new file mode 100644 index 00000000..8bb016e9 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_default_axis_example_select_last_index_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgminDefaultAxisExampleSelectLastIndex(t *testing.T) { + mytest := NewTestArgminDefaultAxisExampleSelectLastIndex() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_default_axis_random.go b/backend/testbackend/onnx/onnx_test_argmin_default_axis_random.go index 7c37480e..508833e9 100644 --- a/backend/testbackend/onnx/onnx_test_argmin_default_axis_random.go +++ b/backend/testbackend/onnx/onnx_test_argmin_default_axis_random.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ArgMin", "TestArgminDefaultAxisRandom", NewTestArgminDefaultAxisRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmin_default_axis_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestArgminDefaultAxisRandom version: 3. func NewTestArgminDefaultAxisRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestArgminDefaultAxisRandom() *testbackend.TestCase { Name: "", OpType: "ArgMin", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000351500)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0001e6500)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_argmin_default_axis_random_select_last_index.go b/backend/testbackend/onnx/onnx_test_argmin_default_axis_random_select_last_index.go new file mode 100644 index 00000000..fae72a2e --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_default_axis_random_select_last_index.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMin", "TestArgminDefaultAxisRandomSelectLastIndex", NewTestArgminDefaultAxisRandomSelectLastIndex) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "select_last_index", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmin_default_axis_random_select_last_index", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgminDefaultAxisRandomSelectLastIndex version: 6. +func NewTestArgminDefaultAxisRandomSelectLastIndex() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMin", + Title: "TestArgminDefaultAxisRandomSelectLastIndex", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xb0, 0x1, 0xa, 0x41, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x69, 0x6e, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0x18, 0xa, 0x11, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x31, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x69, 0x6e, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x62, 0x1c, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x7, 0x12, 0xc, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMin", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000216c00)(name:"keepdims" type:INT i:1 ), + (*ir.AttributeProto)(0xc000216d00)(name:"select_last_index" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984, 1.3608912, 8.511932, -8.579279, -8.257414, -9.595632, 6.6523967, 5.563135, 7.400243, 9.572367, 5.9831715, -0.77041274, 5.6105833}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 3, 4), + tensor.WithBacking([]int64{0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_default_axis_random_select_last_index_test.go b/backend/testbackend/onnx/onnx_test_argmin_default_axis_random_select_last_index_test.go new file mode 100644 index 00000000..87f45712 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_default_axis_random_select_last_index_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgminDefaultAxisRandomSelectLastIndex(t *testing.T) { + mytest := NewTestArgminDefaultAxisRandomSelectLastIndex() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_keepdims_example.go b/backend/testbackend/onnx/onnx_test_argmin_keepdims_example.go index 96fed0f1..b3197a51 100644 --- a/backend/testbackend/onnx/onnx_test_argmin_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_argmin_keepdims_example.go @@ -11,6 +11,129 @@ func init() { testbackend.Register("ArgMin", "TestArgminKeepdimsExample", NewTestArgminKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmin_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestArgminKeepdimsExample version: 3. func NewTestArgminKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +149,8 @@ func NewTestArgminKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ArgMin", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000434000)(name:"axis" type:INT i:1 ), - (*ir.AttributeProto)(0xc000434100)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217200)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217300)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_argmin_keepdims_example_select_last_index.go b/backend/testbackend/onnx/onnx_test_argmin_keepdims_example_select_last_index.go new file mode 100644 index 00000000..ffef5c29 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_keepdims_example_select_last_index.go @@ -0,0 +1,195 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMin", "TestArgminKeepdimsExampleSelectLastIndex", NewTestArgminKeepdimsExampleSelectLastIndex) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "select_last_index", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmin_keepdims_example_select_last_index", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgminKeepdimsExampleSelectLastIndex version: 6. +func NewTestArgminKeepdimsExampleSelectLastIndex() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMin", + Title: "TestArgminKeepdimsExampleSelectLastIndex", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xb2, 0x1, 0xa, 0x4e, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x69, 0x6e, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0x18, 0xa, 0x11, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x69, 0x6e, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x18, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMin", + Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { + (*ir.AttributeProto)(0xc000217600)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217700)(name:"keepdims" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217800)(name:"select_last_index" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{2, 2, 3, 10}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 1), + tensor.WithBacking([]int64{1, 0}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_keepdims_example_select_last_index_test.go b/backend/testbackend/onnx/onnx_test_argmin_keepdims_example_select_last_index_test.go new file mode 100644 index 00000000..46b0a63e --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_keepdims_example_select_last_index_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgminKeepdimsExampleSelectLastIndex(t *testing.T) { + mytest := NewTestArgminKeepdimsExampleSelectLastIndex() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_keepdims_random.go b/backend/testbackend/onnx/onnx_test_argmin_keepdims_random.go index 35049e4e..70b49315 100644 --- a/backend/testbackend/onnx/onnx_test_argmin_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_argmin_keepdims_random.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ArgMin", "TestArgminKeepdimsRandom", NewTestArgminKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmin_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestArgminKeepdimsRandom version: 3. func NewTestArgminKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestArgminKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ArgMin", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000126000)(name:"axis" type:INT i:1 ), - (*ir.AttributeProto)(0xc000126100)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217a00)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217b00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_argmin_keepdims_random_select_last_index.go b/backend/testbackend/onnx/onnx_test_argmin_keepdims_random_select_last_index.go new file mode 100644 index 00000000..fb615d7a --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_keepdims_random_select_last_index.go @@ -0,0 +1,203 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMin", "TestArgminKeepdimsRandomSelectLastIndex", NewTestArgminKeepdimsRandomSelectLastIndex) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "select_last_index", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmin_keepdims_random_select_last_index", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgminKeepdimsRandomSelectLastIndex version: 6. +func NewTestArgminKeepdimsRandomSelectLastIndex() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMin", + Title: "TestArgminKeepdimsRandomSelectLastIndex", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xb9, 0x1, 0xa, 0x4e, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x69, 0x6e, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0x18, 0xa, 0x11, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x69, 0x6e, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x62, 0x1c, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x7, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMin", + Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { + (*ir.AttributeProto)(0xc000217f00)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc000412000)(name:"keepdims" type:INT i:1 ), + (*ir.AttributeProto)(0xc000412100)(name:"select_last_index" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984, 1.3608912, 8.511932, -8.579279, -8.257414, -9.595632, 6.6523967, 5.563135, 7.400243, 9.572367, 5.9831715, -0.77041274, 5.6105833}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 1, 4), + tensor.WithBacking([]int64{1, 2, 1, 2, 1, 2, 0, 0}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_keepdims_random_select_last_index_test.go b/backend/testbackend/onnx/onnx_test_argmin_keepdims_random_select_last_index_test.go new file mode 100644 index 00000000..220ce40e --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_keepdims_random_select_last_index_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgminKeepdimsRandomSelectLastIndex(t *testing.T) { + mytest := NewTestArgminKeepdimsRandomSelectLastIndex() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_example.go b/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_example.go new file mode 100644 index 00000000..085db6fe --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_example.go @@ -0,0 +1,176 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMin", "TestArgminNegativeAxisKeepdimsExample", NewTestArgminNegativeAxisKeepdimsExample) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmin_negative_axis_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgminNegativeAxisKeepdimsExample version: 6. +func NewTestArgminNegativeAxisKeepdimsExample() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMin", + Title: "TestArgminNegativeAxisKeepdimsExample", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x9d, 0x1, 0xa, 0x3d, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x69, 0x6e, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2a, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x69, 0x6e, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x18, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMin", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000216d00)(name:"axis" type:INT i:-1 ), + (*ir.AttributeProto)(0xc000216e00)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{2, 1, 3, 10}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 1), + tensor.WithBacking([]int64{1, 0}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_example_select_last_index.go b/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_example_select_last_index.go new file mode 100644 index 00000000..b7820fee --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_example_select_last_index.go @@ -0,0 +1,195 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMin", "TestArgminNegativeAxisKeepdimsExampleSelectLastIndex", NewTestArgminNegativeAxisKeepdimsExampleSelectLastIndex) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "select_last_index", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmin_negative_axis_keepdims_example_select_last_index", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgminNegativeAxisKeepdimsExampleSelectLastIndex version: 6. +func NewTestArgminNegativeAxisKeepdimsExampleSelectLastIndex() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMin", + Title: "TestArgminNegativeAxisKeepdimsExampleSelectLastIndex", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xc9, 0x1, 0xa, 0x57, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x69, 0x6e, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0x18, 0xa, 0x11, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x3c, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x69, 0x6e, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x18, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMin", + Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { + (*ir.AttributeProto)(0xc000217100)(name:"axis" type:INT i:-1 ), + (*ir.AttributeProto)(0xc000217200)(name:"keepdims" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217300)(name:"select_last_index" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{2, 2, 3, 10}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 1), + tensor.WithBacking([]int64{1, 0}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_example_select_last_index_test.go b/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_example_select_last_index_test.go new file mode 100644 index 00000000..1e4fb953 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_example_select_last_index_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgminNegativeAxisKeepdimsExampleSelectLastIndex(t *testing.T) { + mytest := NewTestArgminNegativeAxisKeepdimsExampleSelectLastIndex() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_example_test.go b/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_example_test.go new file mode 100644 index 00000000..c1681bac --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_example_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgminNegativeAxisKeepdimsExample(t *testing.T) { + mytest := NewTestArgminNegativeAxisKeepdimsExample() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_random.go b/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_random.go new file mode 100644 index 00000000..87366acb --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_random.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMin", "TestArgminNegativeAxisKeepdimsRandom", NewTestArgminNegativeAxisKeepdimsRandom) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmin_negative_axis_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgminNegativeAxisKeepdimsRandom version: 6. +func NewTestArgminNegativeAxisKeepdimsRandom() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMin", + Title: "TestArgminNegativeAxisKeepdimsRandom", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xa4, 0x1, 0xa, 0x3d, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x69, 0x6e, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x29, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x69, 0x6e, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x62, 0x1c, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x7, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMin", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000217500)(name:"axis" type:INT i:-1 ), + (*ir.AttributeProto)(0xc000217600)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984, 1.3608912, 8.511932, -8.579279, -8.257414, -9.595632, 6.6523967, 5.563135, 7.400243, 9.572367, 5.9831715, -0.77041274, 5.6105833}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 1), + tensor.WithBacking([]int64{3, 0, 1, 2, 0, 2}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_random_select_last_index.go b/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_random_select_last_index.go new file mode 100644 index 00000000..fc53f4de --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_random_select_last_index.go @@ -0,0 +1,203 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMin", "TestArgminNegativeAxisKeepdimsRandomSelectLastIndex", NewTestArgminNegativeAxisKeepdimsRandomSelectLastIndex) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "select_last_index", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmin_negative_axis_keepdims_random_select_last_index", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgminNegativeAxisKeepdimsRandomSelectLastIndex version: 6. +func NewTestArgminNegativeAxisKeepdimsRandomSelectLastIndex() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMin", + Title: "TestArgminNegativeAxisKeepdimsRandomSelectLastIndex", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xd0, 0x1, 0xa, 0x57, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x69, 0x6e, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0x18, 0xa, 0x11, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x3b, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x69, 0x6e, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x62, 0x1c, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x7, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMin", + Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { + (*ir.AttributeProto)(0xc000217a00)(name:"axis" type:INT i:-1 ), + (*ir.AttributeProto)(0xc000217b00)(name:"keepdims" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217c00)(name:"select_last_index" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984, 1.3608912, 8.511932, -8.579279, -8.257414, -9.595632, 6.6523967, 5.563135, 7.400243, 9.572367, 5.9831715, -0.77041274, 5.6105833}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 1), + tensor.WithBacking([]int64{3, 0, 1, 2, 0, 2}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_random_select_last_index_test.go b/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_random_select_last_index_test.go new file mode 100644 index 00000000..bc279aa9 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_random_select_last_index_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgminNegativeAxisKeepdimsRandomSelectLastIndex(t *testing.T) { + mytest := NewTestArgminNegativeAxisKeepdimsRandomSelectLastIndex() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_random_test.go b/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_random_test.go new file mode 100644 index 00000000..e6b0286b --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_negative_axis_keepdims_random_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgminNegativeAxisKeepdimsRandom(t *testing.T) { + mytest := NewTestArgminNegativeAxisKeepdimsRandom() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_example.go b/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_example.go index 5c92f18a..b9ccfddd 100644 --- a/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_example.go @@ -11,6 +11,125 @@ func init() { testbackend.Register("ArgMin", "TestArgminNoKeepdimsExample", NewTestArgminNoKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmin_no_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestArgminNoKeepdimsExample version: 3. func NewTestArgminNoKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +145,8 @@ func NewTestArgminNoKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ArgMin", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000126800)(name:"axis" type:INT i:1 ), - (*ir.AttributeProto)(0xc000126900)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc0001e6100)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc0001e6400)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_example_select_last_index.go b/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_example_select_last_index.go new file mode 100644 index 00000000..385ffdde --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_example_select_last_index.go @@ -0,0 +1,191 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMin", "TestArgminNoKeepdimsExampleSelectLastIndex", NewTestArgminNoKeepdimsExampleSelectLastIndex) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "select_last_index", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmin_no_keepdims_example_select_last_index", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgminNoKeepdimsExampleSelectLastIndex version: 6. +func NewTestArgminNoKeepdimsExampleSelectLastIndex() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMin", + Title: "TestArgminNoKeepdimsExampleSelectLastIndex", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xb1, 0x1, 0xa, 0x4e, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x69, 0x6e, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x0, 0xa0, 0x1, 0x2, 0x2a, 0x18, 0xa, 0x11, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x31, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x69, 0x6e, 0x5f, 0x6e, 0x6f, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x14, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMin", + Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { + (*ir.AttributeProto)(0xc000412200)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc000412300)(name:"keepdims" type:INT ), + (*ir.AttributeProto)(0xc000412400)(name:"select_last_index" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{2, 2, 3, 10}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2), + tensor.WithBacking([]int64{1, 0}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_example_select_last_index_test.go b/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_example_select_last_index_test.go new file mode 100644 index 00000000..276e6513 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_example_select_last_index_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgminNoKeepdimsExampleSelectLastIndex(t *testing.T) { + mytest := NewTestArgminNoKeepdimsExampleSelectLastIndex() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_random.go b/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_random.go index df90dc1c..f4319870 100644 --- a/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_random.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ArgMin", "TestArgminNoKeepdimsRandom", NewTestArgminNoKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmin_no_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestArgminNoKeepdimsRandom version: 3. func NewTestArgminNoKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestArgminNoKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ArgMin", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132600)(name:"axis" type:INT i:1 ), - (*ir.AttributeProto)(0xc000132700)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc000216b00)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc000216c00)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_random_select_last_index.go b/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_random_select_last_index.go new file mode 100644 index 00000000..4eb35274 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_random_select_last_index.go @@ -0,0 +1,199 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ArgMin", "TestArgminNoKeepdimsRandomSelectLastIndex", NewTestArgminNoKeepdimsRandomSelectLastIndex) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"result"}, + Name: "", + OpType: "ArgMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "select_last_index", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_argmin_no_keepdims_random_select_last_index", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestArgminNoKeepdimsRandomSelectLastIndex version: 6. +func NewTestArgminNoKeepdimsRandomSelectLastIndex() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ArgMin", + Title: "TestArgminNoKeepdimsRandomSelectLastIndex", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xb8, 0x1, 0xa, 0x4e, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6, 0x41, 0x72, 0x67, 0x4d, 0x69, 0x6e, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x0, 0xa0, 0x1, 0x2, 0x2a, 0x18, 0xa, 0x11, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x30, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x61, 0x72, 0x67, 0x6d, 0x69, 0x6e, 0x5f, 0x6e, 0x6f, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5f, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x62, 0x18, 0xa, 0x6, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"result"}, + Name: "", + OpType: "ArgMin", + Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { + (*ir.AttributeProto)(0xc000217000)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217100)(name:"keepdims" type:INT ), + (*ir.AttributeProto)(0xc000217200)(name:"select_last_index" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984, 1.3608912, 8.511932, -8.579279, -8.257414, -9.595632, 6.6523967, 5.563135, 7.400243, 9.572367, 5.9831715, -0.77041274, 5.6105833}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 4), + tensor.WithBacking([]int64{1, 2, 1, 2, 1, 2, 0, 0}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_random_select_last_index_test.go b/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_random_select_last_index_test.go new file mode 100644 index 00000000..19beecbf --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_argmin_no_keepdims_random_select_last_index_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestArgminNoKeepdimsRandomSelectLastIndex(t *testing.T) { + mytest := NewTestArgminNoKeepdimsRandomSelectLastIndex() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_asin.go b/backend/testbackend/onnx/onnx_test_asin.go index cbad59bb..eb87b9e7 100644 --- a/backend/testbackend/onnx/onnx_test_asin.go +++ b/backend/testbackend/onnx/onnx_test_asin.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Asin", "TestAsin", NewTestAsin) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Asin", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_asin", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAsin version: 3. func NewTestAsin() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_asin_example.go b/backend/testbackend/onnx/onnx_test_asin_example.go index 89919c2d..c9e11954 100644 --- a/backend/testbackend/onnx/onnx_test_asin_example.go +++ b/backend/testbackend/onnx/onnx_test_asin_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Asin", "TestAsinExample", NewTestAsinExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Asin", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_asin_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAsinExample version: 3. func NewTestAsinExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_asinh.go b/backend/testbackend/onnx/onnx_test_asinh.go index f18ee36f..ffcffad2 100644 --- a/backend/testbackend/onnx/onnx_test_asinh.go +++ b/backend/testbackend/onnx/onnx_test_asinh.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Asinh", "TestAsinh", NewTestAsinh) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Asinh", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_asinh", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAsinh version: 3. func NewTestAsinh() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_asinh_example.go b/backend/testbackend/onnx/onnx_test_asinh_example.go index 46f01c56..b8882b32 100644 --- a/backend/testbackend/onnx/onnx_test_asinh_example.go +++ b/backend/testbackend/onnx/onnx_test_asinh_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Asinh", "TestAsinhExample", NewTestAsinhExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Asinh", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_asinh_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAsinhExample version: 3. func NewTestAsinhExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_atan.go b/backend/testbackend/onnx/onnx_test_atan.go index 077469bd..9777314a 100644 --- a/backend/testbackend/onnx/onnx_test_atan.go +++ b/backend/testbackend/onnx/onnx_test_atan.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Atan", "TestAtan", NewTestAtan) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Atan", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_atan", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAtan version: 3. func NewTestAtan() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_atan_example.go b/backend/testbackend/onnx/onnx_test_atan_example.go index ec6034ed..65fca77e 100644 --- a/backend/testbackend/onnx/onnx_test_atan_example.go +++ b/backend/testbackend/onnx/onnx_test_atan_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Atan", "TestAtanExample", NewTestAtanExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Atan", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_atan_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAtanExample version: 3. func NewTestAtanExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_atanh.go b/backend/testbackend/onnx/onnx_test_atanh.go index 5e4fb589..b7904320 100644 --- a/backend/testbackend/onnx/onnx_test_atanh.go +++ b/backend/testbackend/onnx/onnx_test_atanh.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Atanh", "TestAtanh", NewTestAtanh) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Atanh", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_atanh", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAtanh version: 3. func NewTestAtanh() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_atanh_example.go b/backend/testbackend/onnx/onnx_test_atanh_example.go index ef8d67a2..0ecc1a6a 100644 --- a/backend/testbackend/onnx/onnx_test_atanh_example.go +++ b/backend/testbackend/onnx/onnx_test_atanh_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Atanh", "TestAtanhExample", NewTestAtanhExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Atanh", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_atanh_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAtanhExample version: 3. func NewTestAtanhExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_averagepool_1d_default.go b/backend/testbackend/onnx/onnx_test_averagepool_1d_default.go index 5110da15..9c75c0d2 100644 --- a/backend/testbackend/onnx/onnx_test_averagepool_1d_default.go +++ b/backend/testbackend/onnx/onnx_test_averagepool_1d_default.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("AveragePool", "TestAveragepool1dDefault", NewTestAveragepool1dDefault) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "AveragePool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_averagepool_1d_default", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:31}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAveragepool1dDefault version: 3. func NewTestAveragepool1dDefault() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestAveragepool1dDefault() *testbackend.TestCase { Name: "", OpType: "AveragePool", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000133b00)(name:"kernel_shape" type:INTS ints:2 ) + (*ir.AttributeProto)(0xc000217000)(name:"kernel_shape" type:INTS ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_averagepool_2d_ceil.go b/backend/testbackend/onnx/onnx_test_averagepool_2d_ceil.go index 82cf13f2..f022443d 100644 --- a/backend/testbackend/onnx/onnx_test_averagepool_2d_ceil.go +++ b/backend/testbackend/onnx/onnx_test_averagepool_2d_ceil.go @@ -11,6 +11,163 @@ func init() { testbackend.Register("AveragePool", "TestAveragepool2dCeil", NewTestAveragepool2dCeil) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "AveragePool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "ceil_mode", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 3}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_averagepool_2d_ceil", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAveragepool2dCeil version: 4. func NewTestAveragepool2dCeil() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,9 +183,9 @@ func NewTestAveragepool2dCeil() *testbackend.TestCase { Name: "", OpType: "AveragePool", Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { - (*ir.AttributeProto)(0xc000127d00)(name:"ceil_mode" type:INT i:1 ), - (*ir.AttributeProto)(0xc000127e00)(name:"kernel_shape" type:INTS ints:3 ints:3 ), - (*ir.AttributeProto)(0xc000127f00)(name:"strides" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc000217400)(name:"ceil_mode" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217500)(name:"kernel_shape" type:INTS ints:3 ints:3 ), + (*ir.AttributeProto)(0xc000217600)(name:"strides" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_averagepool_2d_default.go b/backend/testbackend/onnx/onnx_test_averagepool_2d_default.go index 14663f29..68dcf4fb 100644 --- a/backend/testbackend/onnx/onnx_test_averagepool_2d_default.go +++ b/backend/testbackend/onnx/onnx_test_averagepool_2d_default.go @@ -11,6 +11,127 @@ func init() { testbackend.Register("AveragePool", "TestAveragepool2dDefault", NewTestAveragepool2dDefault) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "AveragePool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_averagepool_2d_default", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:31}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:31}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAveragepool2dDefault version: 3. func NewTestAveragepool2dDefault() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +147,7 @@ func NewTestAveragepool2dDefault() *testbackend.TestCase { Name: "", OpType: "AveragePool", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000434100)(name:"kernel_shape" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc000217900)(name:"kernel_shape" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_averagepool_2d_pads.go b/backend/testbackend/onnx/onnx_test_averagepool_2d_pads.go index 806d9857..777e567d 100644 --- a/backend/testbackend/onnx/onnx_test_averagepool_2d_pads.go +++ b/backend/testbackend/onnx/onnx_test_averagepool_2d_pads.go @@ -11,6 +11,145 @@ func init() { testbackend.Register("AveragePool", "TestAveragepool2dPads", NewTestAveragepool2dPads) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "AveragePool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 3}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pads", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2, 2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_averagepool_2d_pads", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:28}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:28}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:30}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:30}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAveragepool2dPads version: 3. func NewTestAveragepool2dPads() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +165,8 @@ func NewTestAveragepool2dPads() *testbackend.TestCase { Name: "", OpType: "AveragePool", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132400)(name:"kernel_shape" type:INTS ints:3 ints:3 ), - (*ir.AttributeProto)(0xc000132500)(name:"pads" type:INTS ints:2 ints:2 ints:2 ints:2 ) + (*ir.AttributeProto)(0xc000216b00)(name:"kernel_shape" type:INTS ints:3 ints:3 ), + (*ir.AttributeProto)(0xc000216c00)(name:"pads" type:INTS ints:2 ints:2 ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_averagepool_2d_pads_count_include_pad.go b/backend/testbackend/onnx/onnx_test_averagepool_2d_pads_count_include_pad.go index 979533ef..ed54b0e4 100644 --- a/backend/testbackend/onnx/onnx_test_averagepool_2d_pads_count_include_pad.go +++ b/backend/testbackend/onnx/onnx_test_averagepool_2d_pads_count_include_pad.go @@ -11,6 +11,163 @@ func init() { testbackend.Register("AveragePool", "TestAveragepool2dPadsCountIncludePad", NewTestAveragepool2dPadsCountIncludePad) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "AveragePool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "count_include_pad", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 3}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pads", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2, 2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_averagepool_2d_pads_count_include_pad", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:28}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:28}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:30}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:30}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAveragepool2dPadsCountIncludePad version: 3. func NewTestAveragepool2dPadsCountIncludePad() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,9 +183,9 @@ func NewTestAveragepool2dPadsCountIncludePad() *testbackend.TestCase { Name: "", OpType: "AveragePool", Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { - (*ir.AttributeProto)(0xc000132400)(name:"count_include_pad" type:INT i:1 ), - (*ir.AttributeProto)(0xc000132500)(name:"kernel_shape" type:INTS ints:3 ints:3 ), - (*ir.AttributeProto)(0xc000132600)(name:"pads" type:INTS ints:2 ints:2 ints:2 ints:2 ) + (*ir.AttributeProto)(0xc000216c00)(name:"count_include_pad" type:INT i:1 ), + (*ir.AttributeProto)(0xc000216d00)(name:"kernel_shape" type:INTS ints:3 ints:3 ), + (*ir.AttributeProto)(0xc000216e00)(name:"pads" type:INTS ints:2 ints:2 ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_averagepool_2d_precomputed_pads.go b/backend/testbackend/onnx/onnx_test_averagepool_2d_precomputed_pads.go index 8ebc83ed..36241a50 100644 --- a/backend/testbackend/onnx/onnx_test_averagepool_2d_precomputed_pads.go +++ b/backend/testbackend/onnx/onnx_test_averagepool_2d_precomputed_pads.go @@ -11,6 +11,145 @@ func init() { testbackend.Register("AveragePool", "TestAveragepool2dPrecomputedPads", NewTestAveragepool2dPrecomputedPads) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "AveragePool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {5, 5}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pads", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2, 2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_averagepool_2d_precomputed_pads", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAveragepool2dPrecomputedPads version: 3. func NewTestAveragepool2dPrecomputedPads() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +165,8 @@ func NewTestAveragepool2dPrecomputedPads() *testbackend.TestCase { Name: "", OpType: "AveragePool", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132300)(name:"kernel_shape" type:INTS ints:5 ints:5 ), - (*ir.AttributeProto)(0xc000132400)(name:"pads" type:INTS ints:2 ints:2 ints:2 ints:2 ) + (*ir.AttributeProto)(0xc000216b00)(name:"kernel_shape" type:INTS ints:5 ints:5 ), + (*ir.AttributeProto)(0xc000216c00)(name:"pads" type:INTS ints:2 ints:2 ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_averagepool_2d_precomputed_pads_count_include_pad.go b/backend/testbackend/onnx/onnx_test_averagepool_2d_precomputed_pads_count_include_pad.go index dce07ca2..c7c1cbbc 100644 --- a/backend/testbackend/onnx/onnx_test_averagepool_2d_precomputed_pads_count_include_pad.go +++ b/backend/testbackend/onnx/onnx_test_averagepool_2d_precomputed_pads_count_include_pad.go @@ -11,6 +11,163 @@ func init() { testbackend.Register("AveragePool", "TestAveragepool2dPrecomputedPadsCountIncludePad", NewTestAveragepool2dPrecomputedPadsCountIncludePad) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "AveragePool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "count_include_pad", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {5, 5}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pads", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2, 2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_averagepool_2d_precomputed_pads_count_include_pad", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAveragepool2dPrecomputedPadsCountIncludePad version: 3. func NewTestAveragepool2dPrecomputedPadsCountIncludePad() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,9 +183,9 @@ func NewTestAveragepool2dPrecomputedPadsCountIncludePad() *testbackend.TestCase Name: "", OpType: "AveragePool", Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { - (*ir.AttributeProto)(0xc000126100)(name:"count_include_pad" type:INT i:1 ), - (*ir.AttributeProto)(0xc000126300)(name:"kernel_shape" type:INTS ints:5 ints:5 ), - (*ir.AttributeProto)(0xc000126400)(name:"pads" type:INTS ints:2 ints:2 ints:2 ints:2 ) + (*ir.AttributeProto)(0xc0001e6400)(name:"count_include_pad" type:INT i:1 ), + (*ir.AttributeProto)(0xc0001e6500)(name:"kernel_shape" type:INTS ints:5 ints:5 ), + (*ir.AttributeProto)(0xc0001e6600)(name:"pads" type:INTS ints:2 ints:2 ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_averagepool_2d_precomputed_same_upper.go b/backend/testbackend/onnx/onnx_test_averagepool_2d_precomputed_same_upper.go index dc34c1ea..e70a0fe1 100644 --- a/backend/testbackend/onnx/onnx_test_averagepool_2d_precomputed_same_upper.go +++ b/backend/testbackend/onnx/onnx_test_averagepool_2d_precomputed_same_upper.go @@ -11,6 +11,163 @@ func init() { testbackend.Register("AveragePool", "TestAveragepool2dPrecomputedSameUpper", NewTestAveragepool2dPrecomputedSameUpper) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "AveragePool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "auto_pad", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x53, 0x41, 0x4d, 0x45, 0x5f, 0x55, 0x50, 0x50, 0x45, 0x52}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 3}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_averagepool_2d_precomputed_same_upper", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAveragepool2dPrecomputedSameUpper version: 3. func NewTestAveragepool2dPrecomputedSameUpper() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,9 +183,9 @@ func NewTestAveragepool2dPrecomputedSameUpper() *testbackend.TestCase { Name: "", OpType: "AveragePool", Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { - (*ir.AttributeProto)(0xc000126900)(name:"auto_pad" type:STRING s:"SAME_UPPER" ), - (*ir.AttributeProto)(0xc000126a00)(name:"kernel_shape" type:INTS ints:3 ints:3 ), - (*ir.AttributeProto)(0xc000126b00)(name:"strides" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc000216d00)(name:"auto_pad" type:STRING s:"SAME_UPPER" ), + (*ir.AttributeProto)(0xc000216e00)(name:"kernel_shape" type:INTS ints:3 ints:3 ), + (*ir.AttributeProto)(0xc000216f00)(name:"strides" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_averagepool_2d_precomputed_strides.go b/backend/testbackend/onnx/onnx_test_averagepool_2d_precomputed_strides.go index c9c9debb..ea23ed57 100644 --- a/backend/testbackend/onnx/onnx_test_averagepool_2d_precomputed_strides.go +++ b/backend/testbackend/onnx/onnx_test_averagepool_2d_precomputed_strides.go @@ -11,6 +11,145 @@ func init() { testbackend.Register("AveragePool", "TestAveragepool2dPrecomputedStrides", NewTestAveragepool2dPrecomputedStrides) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "AveragePool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_averagepool_2d_precomputed_strides", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAveragepool2dPrecomputedStrides version: 3. func NewTestAveragepool2dPrecomputedStrides() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +165,8 @@ func NewTestAveragepool2dPrecomputedStrides() *testbackend.TestCase { Name: "", OpType: "AveragePool", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000133000)(name:"kernel_shape" type:INTS ints:2 ints:2 ), - (*ir.AttributeProto)(0xc000133100)(name:"strides" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc000217300)(name:"kernel_shape" type:INTS ints:2 ints:2 ), + (*ir.AttributeProto)(0xc000217400)(name:"strides" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_averagepool_2d_same_lower.go b/backend/testbackend/onnx/onnx_test_averagepool_2d_same_lower.go index 65e86159..67860f16 100644 --- a/backend/testbackend/onnx/onnx_test_averagepool_2d_same_lower.go +++ b/backend/testbackend/onnx/onnx_test_averagepool_2d_same_lower.go @@ -11,6 +11,145 @@ func init() { testbackend.Register("AveragePool", "TestAveragepool2dSameLower", NewTestAveragepool2dSameLower) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "AveragePool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "auto_pad", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x53, 0x41, 0x4d, 0x45, 0x5f, 0x4c, 0x4f, 0x57, 0x45, 0x52}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_averagepool_2d_same_lower", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAveragepool2dSameLower version: 3. func NewTestAveragepool2dSameLower() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +165,8 @@ func NewTestAveragepool2dSameLower() *testbackend.TestCase { Name: "", OpType: "AveragePool", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000127200)(name:"auto_pad" type:STRING s:"SAME_LOWER" ), - (*ir.AttributeProto)(0xc000127300)(name:"kernel_shape" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc000217800)(name:"auto_pad" type:STRING s:"SAME_LOWER" ), + (*ir.AttributeProto)(0xc000217900)(name:"kernel_shape" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_averagepool_2d_same_upper.go b/backend/testbackend/onnx/onnx_test_averagepool_2d_same_upper.go index 8f8a67f7..03dab627 100644 --- a/backend/testbackend/onnx/onnx_test_averagepool_2d_same_upper.go +++ b/backend/testbackend/onnx/onnx_test_averagepool_2d_same_upper.go @@ -11,6 +11,145 @@ func init() { testbackend.Register("AveragePool", "TestAveragepool2dSameUpper", NewTestAveragepool2dSameUpper) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "AveragePool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "auto_pad", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x53, 0x41, 0x4d, 0x45, 0x5f, 0x55, 0x50, 0x50, 0x45, 0x52}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_averagepool_2d_same_upper", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAveragepool2dSameUpper version: 3. func NewTestAveragepool2dSameUpper() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +165,8 @@ func NewTestAveragepool2dSameUpper() *testbackend.TestCase { Name: "", OpType: "AveragePool", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132300)(name:"auto_pad" type:STRING s:"SAME_UPPER" ), - (*ir.AttributeProto)(0xc000132400)(name:"kernel_shape" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc0001e6400)(name:"auto_pad" type:STRING s:"SAME_UPPER" ), + (*ir.AttributeProto)(0xc0001e6500)(name:"kernel_shape" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_averagepool_2d_strides.go b/backend/testbackend/onnx/onnx_test_averagepool_2d_strides.go index ba33b733..014d8e18 100644 --- a/backend/testbackend/onnx/onnx_test_averagepool_2d_strides.go +++ b/backend/testbackend/onnx/onnx_test_averagepool_2d_strides.go @@ -11,6 +11,145 @@ func init() { testbackend.Register("AveragePool", "TestAveragepool2dStrides", NewTestAveragepool2dStrides) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "AveragePool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {5, 5}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 3}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_averagepool_2d_strides", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAveragepool2dStrides version: 3. func NewTestAveragepool2dStrides() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +165,8 @@ func NewTestAveragepool2dStrides() *testbackend.TestCase { Name: "", OpType: "AveragePool", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000126000)(name:"kernel_shape" type:INTS ints:5 ints:5 ), - (*ir.AttributeProto)(0xc000126100)(name:"strides" type:INTS ints:3 ints:3 ) + (*ir.AttributeProto)(0xc0001e6100)(name:"kernel_shape" type:INTS ints:5 ints:5 ), + (*ir.AttributeProto)(0xc0001e6400)(name:"strides" type:INTS ints:3 ints:3 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_averagepool_3d_default.go b/backend/testbackend/onnx/onnx_test_averagepool_3d_default.go index 5a2cef63..83c7a1d8 100644 --- a/backend/testbackend/onnx/onnx_test_averagepool_3d_default.go +++ b/backend/testbackend/onnx/onnx_test_averagepool_3d_default.go @@ -11,6 +11,135 @@ func init() { testbackend.Register("AveragePool", "TestAveragepool3dDefault", NewTestAveragepool3dDefault) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "AveragePool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_averagepool_3d_default", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:31}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:31}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:31}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestAveragepool3dDefault version: 3. func NewTestAveragepool3dDefault() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +155,7 @@ func NewTestAveragepool3dDefault() *testbackend.TestCase { Name: "", OpType: "AveragePool", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126100)(name:"kernel_shape" type:INTS ints:2 ints:2 ints:2 ) + (*ir.AttributeProto)(0xc0001e6400)(name:"kernel_shape" type:INTS ints:2 ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_basic_conv_with_padding.go b/backend/testbackend/onnx/onnx_test_basic_conv_with_padding.go index 25f2b526..d0fb84e6 100644 --- a/backend/testbackend/onnx/onnx_test_basic_conv_with_padding.go +++ b/backend/testbackend/onnx/onnx_test_basic_conv_with_padding.go @@ -11,6 +11,177 @@ func init() { testbackend.Register("Conv", "TestBasicConvWithPadding", NewTestBasicConvWithPadding) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "W"}, + Output: {"y"}, + Name: "", + OpType: "Conv", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 3}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pads", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1, 1, 1, 1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_basic_conv_with_padding", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "W", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestBasicConvWithPadding version: 3. func NewTestBasicConvWithPadding() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +197,8 @@ func NewTestBasicConvWithPadding() *testbackend.TestCase { Name: "", OpType: "Conv", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132300)(name:"kernel_shape" type:INTS ints:3 ints:3 ), - (*ir.AttributeProto)(0xc000132400)(name:"pads" type:INTS ints:1 ints:1 ints:1 ints:1 ) + (*ir.AttributeProto)(0xc0001e6100)(name:"kernel_shape" type:INTS ints:3 ints:3 ), + (*ir.AttributeProto)(0xc0001e6400)(name:"pads" type:INTS ints:1 ints:1 ints:1 ints:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_basic_conv_without_padding.go b/backend/testbackend/onnx/onnx_test_basic_conv_without_padding.go index b52ddfed..7ecdf306 100644 --- a/backend/testbackend/onnx/onnx_test_basic_conv_without_padding.go +++ b/backend/testbackend/onnx/onnx_test_basic_conv_without_padding.go @@ -11,6 +11,177 @@ func init() { testbackend.Register("Conv", "TestBasicConvWithoutPadding", NewTestBasicConvWithoutPadding) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "W"}, + Output: {"y"}, + Name: "", + OpType: "Conv", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 3}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pads", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 0, 0, 0}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_basic_conv_without_padding", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "W", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestBasicConvWithoutPadding version: 3. func NewTestBasicConvWithoutPadding() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +197,8 @@ func NewTestBasicConvWithoutPadding() *testbackend.TestCase { Name: "", OpType: "Conv", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132d00)(name:"kernel_shape" type:INTS ints:3 ints:3 ), - (*ir.AttributeProto)(0xc000132e00)(name:"pads" type:INTS ints:0 ints:0 ints:0 ints:0 ) + (*ir.AttributeProto)(0xc0001e6400)(name:"kernel_shape" type:INTS ints:3 ints:3 ), + (*ir.AttributeProto)(0xc0001e6500)(name:"pads" type:INTS ints:0 ints:0 ints:0 ints:0 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_batchnorm_epsilon.go b/backend/testbackend/onnx/onnx_test_batchnorm_epsilon.go index c90edb88..48781112 100644 --- a/backend/testbackend/onnx/onnx_test_batchnorm_epsilon.go +++ b/backend/testbackend/onnx/onnx_test_batchnorm_epsilon.go @@ -11,6 +11,207 @@ func init() { testbackend.Register("BatchNormalization", "TestBatchnormEpsilon", NewTestBatchnormEpsilon) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "s", "bias", "mean", "var"}, + Output: {"y"}, + Name: "", + OpType: "BatchNormalization", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "epsilon", + RefAttrName: "", + DocString: "", + Type: 1, + F: 0.009999999776482582, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_batchnorm_epsilon", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "s", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "bias", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "mean", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "var", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestBatchnormEpsilon version: 3. func NewTestBatchnormEpsilon() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +227,7 @@ func NewTestBatchnormEpsilon() *testbackend.TestCase { Name: "", OpType: "BatchNormalization", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000132f00)(name:"epsilon" type:FLOAT f:0.01 ) + (*ir.AttributeProto)(0xc000217000)(name:"epsilon" type:FLOAT f:0.01 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_batchnorm_epsilon_old.go b/backend/testbackend/onnx/onnx_test_batchnorm_epsilon_old.go new file mode 100644 index 00000000..db843317 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_batchnorm_epsilon_old.go @@ -0,0 +1,273 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("BatchNormalization", "TestBatchnormEpsilonOld", NewTestBatchnormEpsilonOld) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "s", "bias", "mean", "var"}, + Output: {"y"}, + Name: "", + OpType: "BatchNormalization", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "epsilon", + RefAttrName: "", + DocString: "", + Type: 1, + F: 0.009999999776482582, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_batchnorm_epsilon_old", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "s", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "bias", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "mean", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "var", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestBatchnormEpsilonOld version: 6. +func NewTestBatchnormEpsilonOld() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "BatchNormalization", + Title: "TestBatchnormEpsilonOld", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xe5, 0x1, 0xa, 0x41, 0xa, 0x1, 0x78, 0xa, 0x1, 0x73, 0xa, 0x4, 0x62, 0x69, 0x61, 0x73, 0xa, 0x4, 0x6d, 0x65, 0x61, 0x6e, 0xa, 0x3, 0x76, 0x61, 0x72, 0x12, 0x1, 0x79, 0x22, 0x12, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x11, 0xa, 0x7, 0x65, 0x70, 0x73, 0x69, 0x6c, 0x6f, 0x6e, 0x15, 0xa, 0xd7, 0x23, 0x3c, 0xa0, 0x1, 0x1, 0x12, 0x1a, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x6e, 0x6f, 0x72, 0x6d, 0x5f, 0x65, 0x70, 0x73, 0x69, 0x6c, 0x6f, 0x6e, 0x5f, 0x6f, 0x6c, 0x64, 0x5a, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x5a, 0xf, 0xa, 0x1, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x12, 0xa, 0x4, 0x62, 0x69, 0x61, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x12, 0xa, 0x4, 0x6d, 0x65, 0x61, 0x6e, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x11, 0xa, 0x3, 0x76, 0x61, 0x72, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"x", "s", "bias", "mean", "var"}, + Output: []string{"y"}, + Name: "", + OpType: "BatchNormalization", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0002d6400)(name:"epsilon" type:FLOAT f:0.01 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117, -0.67246044, -0.35955316, -0.8131463, -1.7262826, 0.17742614, -0.40178093, -1.6301984, 0.46278226, -0.9072984, 0.051945396, 0.7290906, 0.12898292, 1.1394007, -1.2348258, 0.40234163, -0.6848101, -0.87079716, -0.5788497, -0.31155252, 0.05616534, -1.1651498, 0.9008265, 0.46566245, -1.5362437, 1.4882522, 1.8958892, 1.1787796, -0.17992483, -1.0707526, 1.0544517, -0.40317693, 1.222445, 0.20827498, 0.97663903, 0.3563664, 0.7065732, 0.01050002, 1.7858706, 0.12691209, 0.40198937, 1.8831507, -1.347759, -1.270485, 0.9693967, -1.1731234, 1.9436212, -0.41361898, -0.7474548, 1.922942, 1.4805148, 1.867559, 0.90604466, -0.86122566, 1.9100649, -0.26800337, 0.8024564, 0.947252, -0.15501009, 0.61407936, 0.9222067}), + ), + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]float32{0.37642553, -1.0994008, 0.2982382}), + ), + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]float32{1.3263859, -0.69456786, -0.14963454}), + ), + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]float32{-0.43515354, 1.8492638, 0.67229474}), + ), + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]float32{0.9755215, 0.8558034, 0.011714084}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4, 5), + tensor.WithBacking([]float32{2.160282, 1.6431195, 1.8625059, 2.3410907, 2.1995292, 1.1208229, 1.8516426, 1.433996, 1.452249, 1.6470785, 1.5460061, 2.0428197, 1.7799582, 1.5375245, 1.6596919, 1.6179104, 2.0579133, 1.4135956, 1.6100968, 1.1675311, 4.506847, 0.71812826, 0.46903986, 2.3672945, -1.1913923, 3.208784, 1.4363358, 1.7115653, -0.32063043, -0.24569702, 1.3073254, 1.0435891, 2.5393505, 3.8307803, 1.9014714, 1.3056693, 0.036770284, 0.069747865, 1.9480412, 1.8475821, -3.6324859, -4.3842998, -4.9636493, 2.4379027, -2.541796, -2.396928, -4.045855, 0.06327261, -4.7766957, -1.940871, -3.3226516, -0.72724444, -2.5441291, -3.899803, -1.5673411, -0.6433948, -1.3756773, -0.8981249, -2.794117, -2.24446, 1.2364037, 1.355052, 1.1830584, 0.8368149, 1.5586641, 1.33904, 0.87324816, 1.6668656, 1.1473577, 1.5110843, 1.7678446, 1.5402954, 1.9234262, 1.0231657, 1.6439477, 1.2317209, 1.1611983, 1.2718991, 1.373253, 1.5126843, 2.8670657, 0.42604357, 0.9402048, 3.305526, -0.26802018, -0.74965733, 0.09763235, 1.7029884, 2.7555318, 0.24453002, 1.9667685, 0.046040177, 1.244317, 0.3364684, 1.0693419, 0.65556055, 1.4779949, -0.6196666, 1.3404498, 1.0154369, 2.3010361, -4.238054, -4.081658, 0.45167488, -3.8846056, 2.4234233, -2.3474326, -3.0230885, 2.3815703, 1.4861348, 2.2694798, 0.32345566, -3.2533512, 2.3555083, -2.0527189, 0.11380169, 0.40685582, -1.8240302, -0.26745757, 0.35616624}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_clip_default_inbounds_test.go b/backend/testbackend/onnx/onnx_test_batchnorm_epsilon_old_test.go similarity index 87% rename from backend/testbackend/onnx/onnx_test_clip_default_inbounds_test.go rename to backend/testbackend/onnx/onnx_test_batchnorm_epsilon_old_test.go index 47ec362f..e6a30e9f 100644 --- a/backend/testbackend/onnx/onnx_test_clip_default_inbounds_test.go +++ b/backend/testbackend/onnx/onnx_test_batchnorm_epsilon_old_test.go @@ -7,8 +7,8 @@ import ( "github.com/owulveryck/onnx-go/internal/onnx/ir" ) -func TestNewTestClipDefaultInbounds(t *testing.T) { - mytest := NewTestClipDefaultInbounds() +func TestNewTestBatchnormEpsilonOld(t *testing.T) { + mytest := NewTestBatchnormEpsilonOld() var model ir.ModelProto err := proto.Unmarshal(mytest.ModelB, &model) if err != nil { diff --git a/backend/testbackend/onnx/onnx_test_batchnorm_example.go b/backend/testbackend/onnx/onnx_test_batchnorm_example.go index a5d7059f..19880ff6 100644 --- a/backend/testbackend/onnx/onnx_test_batchnorm_example.go +++ b/backend/testbackend/onnx/onnx_test_batchnorm_example.go @@ -11,6 +11,188 @@ func init() { testbackend.Register("BatchNormalization", "TestBatchnormExample", NewTestBatchnormExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "s", "bias", "mean", "var"}, + Output: {"y"}, + Name: "", + OpType: "BatchNormalization", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_batchnorm_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "s", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "bias", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "mean", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "var", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestBatchnormExample version: 3. func NewTestBatchnormExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_batchnorm_example_old.go b/backend/testbackend/onnx/onnx_test_batchnorm_example_old.go new file mode 100644 index 00000000..3c280f6a --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_batchnorm_example_old.go @@ -0,0 +1,252 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("BatchNormalization", "TestBatchnormExampleOld", NewTestBatchnormExampleOld) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "s", "bias", "mean", "var"}, + Output: {"y"}, + Name: "", + OpType: "BatchNormalization", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_batchnorm_example_old", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "s", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "bias", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "mean", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "var", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestBatchnormExampleOld version: 6. +func NewTestBatchnormExampleOld() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "BatchNormalization", + Title: "TestBatchnormExampleOld", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xd2, 0x1, 0xa, 0x2e, 0xa, 0x1, 0x78, 0xa, 0x1, 0x73, 0xa, 0x4, 0x62, 0x69, 0x61, 0x73, 0xa, 0x4, 0x6d, 0x65, 0x61, 0x6e, 0xa, 0x3, 0x76, 0x61, 0x72, 0x12, 0x1, 0x79, 0x22, 0x12, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x6e, 0x6f, 0x72, 0x6d, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x6f, 0x6c, 0x64, 0x5a, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0x5a, 0xf, 0xa, 0x1, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x12, 0xa, 0x4, 0x62, 0x69, 0x61, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x12, 0xa, 0x4, 0x6d, 0x65, 0x61, 0x6e, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x11, 0xa, 0x3, 0x76, 0x61, 0x72, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"x", "s", "bias", "mean", "var"}, + Output: []string{"y"}, + Name: "", + OpType: "BatchNormalization", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 2, 1, 3), + tensor.WithBacking([]float32{-1, 0, 1, 2, 3, 4}), + ), + + tensor.New( + tensor.WithShape(2), + tensor.WithBacking([]float32{1, 1.5}), + ), + + tensor.New( + tensor.WithShape(2), + tensor.WithBacking([]float32{0, 1}), + ), + + tensor.New( + tensor.WithShape(2), + tensor.WithBacking([]float32{0, 3}), + ), + + tensor.New( + tensor.WithShape(2), + tensor.WithBacking([]float32{1, 1.5}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 2, 1, 3), + tensor.WithBacking([]float32{-0.999995, 0, 0.999995, -0.22474074, 1, 2.2247407}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_batchnorm_example_old_test.go b/backend/testbackend/onnx/onnx_test_batchnorm_example_old_test.go new file mode 100644 index 00000000..c3f86214 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_batchnorm_example_old_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestBatchnormExampleOld(t *testing.T) { + mytest := NewTestBatchnormExampleOld() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_cast_DOUBLE_to_FLOAT.go b/backend/testbackend/onnx/onnx_test_cast_DOUBLE_to_FLOAT.go index be86ea02..e24108ba 100644 --- a/backend/testbackend/onnx/onnx_test_cast_DOUBLE_to_FLOAT.go +++ b/backend/testbackend/onnx/onnx_test_cast_DOUBLE_to_FLOAT.go @@ -11,6 +11,111 @@ func init() { testbackend.Register("Cast", "TestCastDOUBLEToFLOAT", NewTestCastDOUBLEToFLOAT) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"input"}, + Output: {"output"}, + Name: "", + OpType: "Cast", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "to", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_cast_DOUBLE_to_FLOAT", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "input", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestCastDOUBLEToFLOAT version: 4. func NewTestCastDOUBLEToFLOAT() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +131,7 @@ func NewTestCastDOUBLEToFLOAT() *testbackend.TestCase { Name: "", OpType: "Cast", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000132400)(name:"to" type:INT i:1 ) + (*ir.AttributeProto)(0xc000216e00)(name:"to" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_cast_FLOAT_to_DOUBLE.go b/backend/testbackend/onnx/onnx_test_cast_FLOAT_to_DOUBLE.go index 2494209a..d0db7dc0 100644 --- a/backend/testbackend/onnx/onnx_test_cast_FLOAT_to_DOUBLE.go +++ b/backend/testbackend/onnx/onnx_test_cast_FLOAT_to_DOUBLE.go @@ -11,6 +11,111 @@ func init() { testbackend.Register("Cast", "TestCastFLOATToDOUBLE", NewTestCastFLOATToDOUBLE) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"input"}, + Output: {"output"}, + Name: "", + OpType: "Cast", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "to", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 11, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_cast_FLOAT_to_DOUBLE", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "input", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestCastFLOATToDOUBLE version: 4. func NewTestCastFLOATToDOUBLE() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +131,7 @@ func NewTestCastFLOATToDOUBLE() *testbackend.TestCase { Name: "", OpType: "Cast", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126b00)(name:"to" type:INT i:11 ) + (*ir.AttributeProto)(0xc000217500)(name:"to" type:INT i:11 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_ceil.go b/backend/testbackend/onnx/onnx_test_ceil.go index 11abceb5..4c74e9bb 100644 --- a/backend/testbackend/onnx/onnx_test_ceil.go +++ b/backend/testbackend/onnx/onnx_test_ceil.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Ceil", "TestCeil", NewTestCeil) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Ceil", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_ceil", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestCeil version: 3. func NewTestCeil() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_ceil_example.go b/backend/testbackend/onnx/onnx_test_ceil_example.go index ab512378..253dd68f 100644 --- a/backend/testbackend/onnx/onnx_test_ceil_example.go +++ b/backend/testbackend/onnx/onnx_test_ceil_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Ceil", "TestCeilExample", NewTestCeilExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Ceil", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_ceil_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestCeilExample version: 3. func NewTestCeilExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_clip.go b/backend/testbackend/onnx/onnx_test_clip.go index 22eea1e5..fb88fed5 100644 --- a/backend/testbackend/onnx/onnx_test_clip.go +++ b/backend/testbackend/onnx/onnx_test_clip.go @@ -11,24 +11,141 @@ func init() { testbackend.Register("Clip", "TestClip", NewTestClip) } -// NewTestClip version: 3. +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "min", "max"}, + Output: {"y"}, + Name: "", + OpType: "Clip", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_clip", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "min", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "max", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestClip version: 5. func NewTestClip() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "Clip", Title: "TestClip", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x69, 0xa, 0x2a, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x4, 0x43, 0x6c, 0x69, 0x70, 0x2a, 0xd, 0xa, 0x3, 0x6d, 0x61, 0x78, 0x15, 0x0, 0x0, 0x80, 0x3f, 0xa0, 0x1, 0x1, 0x2a, 0xd, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0x15, 0x0, 0x0, 0x80, 0xbf, 0xa0, 0x1, 0x1, 0x12, 0x9, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6c, 0x69, 0x70, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x73, 0xa, 0x16, 0xa, 0x1, 0x78, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0xa, 0x3, 0x6d, 0x61, 0x78, 0x12, 0x1, 0x79, 0x22, 0x4, 0x43, 0x6c, 0x69, 0x70, 0x12, 0x9, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6c, 0x69, 0x70, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x5a, 0xd, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x5a, 0xd, 0xa, 0x3, 0x6d, 0x61, 0x78, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x62, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, /* &ir.NodeProto{ - Input: []string{"x"}, + Input: []string{"x", "min", "max"}, Output: []string{"y"}, Name: "", OpType: "Clip", - Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000127300)(name:"max" type:FLOAT f:1 ), - (*ir.AttributeProto)(0xc000127400)(name:"min" type:FLOAT f:-1 ) - } + Attributes: ([]*ir.AttributeProto) , }, @@ -41,6 +158,16 @@ func NewTestClip() *testbackend.TestCase { tensor.WithShape(3, 4, 5), tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{-1}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{1}), + ), }, ExpectedOutput: []tensor.Tensor{ diff --git a/backend/testbackend/onnx/onnx_test_clip_default_inbounds.go b/backend/testbackend/onnx/onnx_test_clip_default_inbounds.go deleted file mode 100644 index 35d410a6..00000000 --- a/backend/testbackend/onnx/onnx_test_clip_default_inbounds.go +++ /dev/null @@ -1,50 +0,0 @@ -package onnxtest - -// this file is auto-generated... DO NOT EDIT - -import ( - "github.com/owulveryck/onnx-go/backend/testbackend" - "gorgonia.org/tensor" -) - -func init() { - testbackend.Register("Clip", "TestClipDefaultInbounds", NewTestClipDefaultInbounds) -} - -// NewTestClipDefaultInbounds version: 3. -func NewTestClipDefaultInbounds() *testbackend.TestCase { - return &testbackend.TestCase{ - OpType: "Clip", - Title: "TestClipDefaultInbounds", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x4c, 0xa, 0xc, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x4, 0x43, 0x6c, 0x69, 0x70, 0x12, 0x1a, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6c, 0x69, 0x70, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0x9}, - - /* - - &ir.NodeProto{ - Input: []string{"x"}, - Output: []string{"y"}, - Name: "", - OpType: "Clip", - Attributes: ([]*ir.AttributeProto) - , - }, - - - */ - - Input: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(3), - tensor.WithBacking([]float32{-1, 0, 1}), - ), - }, - ExpectedOutput: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(3), - tensor.WithBacking([]float32{-1, 0, 1}), - ), - }, - } -} diff --git a/backend/testbackend/onnx/onnx_test_clip_default_max.go b/backend/testbackend/onnx/onnx_test_clip_default_max.go deleted file mode 100644 index e937bfd5..00000000 --- a/backend/testbackend/onnx/onnx_test_clip_default_max.go +++ /dev/null @@ -1,52 +0,0 @@ -package onnxtest - -// this file is auto-generated... DO NOT EDIT - -import ( - "github.com/owulveryck/onnx-go/backend/testbackend" - "gorgonia.org/tensor" -) - -func init() { - testbackend.Register("Clip", "TestClipDefaultMax", NewTestClipDefaultMax) -} - -// NewTestClipDefaultMax version: 3. -func NewTestClipDefaultMax() *testbackend.TestCase { - return &testbackend.TestCase{ - OpType: "Clip", - Title: "TestClipDefaultMax", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x66, 0xa, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x4, 0x43, 0x6c, 0x69, 0x70, 0x2a, 0xd, 0xa, 0x3, 0x6d, 0x61, 0x78, 0x15, 0x0, 0x0, 0x0, 0x0, 0xa0, 0x1, 0x1, 0x12, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6c, 0x69, 0x70, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x6d, 0x61, 0x78, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0x9}, - - /* - - &ir.NodeProto{ - Input: []string{"x"}, - Output: []string{"y"}, - Name: "", - OpType: "Clip", - Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000133000)(name:"max" type:FLOAT ) - } - , - }, - - - */ - - Input: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(3, 4, 5), - tensor.WithBacking([]float32{-0.67246044, -0.35955316, -0.8131463, -1.7262826, 0.17742614, -0.40178093, -1.6301984, 0.46278226, -0.9072984, 0.051945396, 0.7290906, 0.12898292, 1.1394007, -1.2348258, 0.40234163, -0.6848101, -0.87079716, -0.5788497, -0.31155252, 0.05616534, -1.1651498, 0.9008265, 0.46566245, -1.5362437, 1.4882522, 1.8958892, 1.1787796, -0.17992483, -1.0707526, 1.0544517, -0.40317693, 1.222445, 0.20827498, 0.97663903, 0.3563664, 0.7065732, 0.01050002, 1.7858706, 0.12691209, 0.40198937, 1.8831507, -1.347759, -1.270485, 0.9693967, -1.1731234, 1.9436212, -0.41361898, -0.7474548, 1.922942, 1.4805148, 1.867559, 0.90604466, -0.86122566, 1.9100649, -0.26800337, 0.8024564, 0.947252, -0.15501009, 0.61407936, 0.9222067}), - ), - }, - ExpectedOutput: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(3, 4, 5), - tensor.WithBacking([]float32{-0.67246044, -0.35955316, -0.8131463, -1.7262826, 0, -0.40178093, -1.6301984, 0, -0.9072984, 0, 0, 0, 0, -1.2348258, 0, -0.6848101, -0.87079716, -0.5788497, -0.31155252, 0, -1.1651498, 0, 0, -1.5362437, 0, 0, 0, -0.17992483, -1.0707526, 0, -0.40317693, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1.347759, -1.270485, 0, -1.1731234, 0, -0.41361898, -0.7474548, 0, 0, 0, 0, -0.86122566, 0, -0.26800337, 0, 0, -0.15501009, 0, 0}), - ), - }, - } -} diff --git a/backend/testbackend/onnx/onnx_test_clip_default_min.go b/backend/testbackend/onnx/onnx_test_clip_default_min.go index f46b03b4..30c6a1b4 100644 --- a/backend/testbackend/onnx/onnx_test_clip_default_min.go +++ b/backend/testbackend/onnx/onnx_test_clip_default_min.go @@ -11,23 +11,128 @@ func init() { testbackend.Register("Clip", "TestClipDefaultMin", NewTestClipDefaultMin) } -// NewTestClipDefaultMin version: 3. +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "min"}, + Output: {"y"}, + Name: "", + OpType: "Clip", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_clip_default_min", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "min", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestClipDefaultMin version: 5. func NewTestClipDefaultMin() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "Clip", Title: "TestClipDefaultMin", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x66, 0xa, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x4, 0x43, 0x6c, 0x69, 0x70, 0x2a, 0xd, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0x15, 0x0, 0x0, 0x0, 0x0, 0xa0, 0x1, 0x1, 0x12, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6c, 0x69, 0x70, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x6d, 0x69, 0x6e, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x6b, 0xa, 0x11, 0xa, 0x1, 0x78, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0x12, 0x1, 0x79, 0x22, 0x4, 0x43, 0x6c, 0x69, 0x70, 0x12, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6c, 0x69, 0x70, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x6d, 0x69, 0x6e, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x5a, 0xd, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x62, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, /* &ir.NodeProto{ - Input: []string{"x"}, + Input: []string{"x", "min"}, Output: []string{"y"}, Name: "", OpType: "Clip", - Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000133600)(name:"min" type:FLOAT ) - } + Attributes: ([]*ir.AttributeProto) , }, @@ -40,6 +145,11 @@ func NewTestClipDefaultMin() *testbackend.TestCase { tensor.WithShape(3, 4, 5), tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{0}), + ), }, ExpectedOutput: []tensor.Tensor{ diff --git a/backend/testbackend/onnx/onnx_test_clip_example.go b/backend/testbackend/onnx/onnx_test_clip_example.go index bfb13df4..b8a61e1e 100644 --- a/backend/testbackend/onnx/onnx_test_clip_example.go +++ b/backend/testbackend/onnx/onnx_test_clip_example.go @@ -11,24 +11,125 @@ func init() { testbackend.Register("Clip", "TestClipExample", NewTestClipExample) } -// NewTestClipExample version: 3. +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "min", "max"}, + Output: {"y"}, + Name: "", + OpType: "Clip", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_clip_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "min", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "max", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestClipExample version: 5. func NewTestClipExample() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "Clip", Title: "TestClipExample", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x61, 0xa, 0x2a, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x4, 0x43, 0x6c, 0x69, 0x70, 0x2a, 0xd, 0xa, 0x3, 0x6d, 0x61, 0x78, 0x15, 0x0, 0x0, 0x80, 0x3f, 0xa0, 0x1, 0x1, 0x2a, 0xd, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0x15, 0x0, 0x0, 0x80, 0xbf, 0xa0, 0x1, 0x1, 0x12, 0x11, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6c, 0x69, 0x70, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x6b, 0xa, 0x16, 0xa, 0x1, 0x78, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0xa, 0x3, 0x6d, 0x61, 0x78, 0x12, 0x1, 0x79, 0x22, 0x4, 0x43, 0x6c, 0x69, 0x70, 0x12, 0x11, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6c, 0x69, 0x70, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x5a, 0xd, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x5a, 0xd, 0xa, 0x3, 0x6d, 0x61, 0x78, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, /* &ir.NodeProto{ - Input: []string{"x"}, + Input: []string{"x", "min", "max"}, Output: []string{"y"}, Name: "", OpType: "Clip", - Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000118600)(name:"max" type:FLOAT f:1 ), - (*ir.AttributeProto)(0xc000118700)(name:"min" type:FLOAT f:-1 ) - } + Attributes: ([]*ir.AttributeProto) , }, @@ -41,6 +142,16 @@ func NewTestClipExample() *testbackend.TestCase { tensor.WithShape(3), tensor.WithBacking([]float32{-2, 0, 2}), ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{-1}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{1}), + ), }, ExpectedOutput: []tensor.Tensor{ diff --git a/backend/testbackend/onnx/onnx_test_clip_inbounds.go b/backend/testbackend/onnx/onnx_test_clip_inbounds.go index ead9582c..509ec351 100644 --- a/backend/testbackend/onnx/onnx_test_clip_inbounds.go +++ b/backend/testbackend/onnx/onnx_test_clip_inbounds.go @@ -11,24 +11,125 @@ func init() { testbackend.Register("Clip", "TestClipInbounds", NewTestClipInbounds) } -// NewTestClipInbounds version: 3. +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "min", "max"}, + Output: {"y"}, + Name: "", + OpType: "Clip", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_clip_inbounds", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "min", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "max", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestClipInbounds version: 5. func NewTestClipInbounds() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "Clip", Title: "TestClipInbounds", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x62, 0xa, 0x2a, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x4, 0x43, 0x6c, 0x69, 0x70, 0x2a, 0xd, 0xa, 0x3, 0x6d, 0x61, 0x78, 0x15, 0x0, 0x0, 0xa0, 0x40, 0xa0, 0x1, 0x1, 0x2a, 0xd, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0x15, 0x0, 0x0, 0xa0, 0xc0, 0xa0, 0x1, 0x1, 0x12, 0x12, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6c, 0x69, 0x70, 0x5f, 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x6c, 0xa, 0x16, 0xa, 0x1, 0x78, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0xa, 0x3, 0x6d, 0x61, 0x78, 0x12, 0x1, 0x79, 0x22, 0x4, 0x43, 0x6c, 0x69, 0x70, 0x12, 0x12, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6c, 0x69, 0x70, 0x5f, 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x5a, 0xd, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x5a, 0xd, 0xa, 0x3, 0x6d, 0x61, 0x78, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, /* &ir.NodeProto{ - Input: []string{"x"}, + Input: []string{"x", "min", "max"}, Output: []string{"y"}, Name: "", OpType: "Clip", - Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000133a00)(name:"max" type:FLOAT f:5 ), - (*ir.AttributeProto)(0xc000133b00)(name:"min" type:FLOAT f:-5 ) - } + Attributes: ([]*ir.AttributeProto) , }, @@ -41,6 +142,16 @@ func NewTestClipInbounds() *testbackend.TestCase { tensor.WithShape(3), tensor.WithBacking([]float32{-1, 0, 1}), ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{-5}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{5}), + ), }, ExpectedOutput: []tensor.Tensor{ diff --git a/backend/testbackend/onnx/onnx_test_clip_outbounds.go b/backend/testbackend/onnx/onnx_test_clip_outbounds.go index 18a5203c..dc5db091 100644 --- a/backend/testbackend/onnx/onnx_test_clip_outbounds.go +++ b/backend/testbackend/onnx/onnx_test_clip_outbounds.go @@ -11,24 +11,125 @@ func init() { testbackend.Register("Clip", "TestClipOutbounds", NewTestClipOutbounds) } -// NewTestClipOutbounds version: 3. +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "min", "max"}, + Output: {"y"}, + Name: "", + OpType: "Clip", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_clip_outbounds", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "min", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "max", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestClipOutbounds version: 5. func NewTestClipOutbounds() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "Clip", Title: "TestClipOutbounds", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x63, 0xa, 0x2a, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x4, 0x43, 0x6c, 0x69, 0x70, 0x2a, 0xd, 0xa, 0x3, 0x6d, 0x61, 0x78, 0x15, 0x0, 0x0, 0xa0, 0x40, 0xa0, 0x1, 0x1, 0x2a, 0xd, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0x15, 0x0, 0x0, 0xa0, 0xc0, 0xa0, 0x1, 0x1, 0x12, 0x13, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6c, 0x69, 0x70, 0x5f, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x6d, 0xa, 0x16, 0xa, 0x1, 0x78, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0xa, 0x3, 0x6d, 0x61, 0x78, 0x12, 0x1, 0x79, 0x22, 0x4, 0x43, 0x6c, 0x69, 0x70, 0x12, 0x13, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6c, 0x69, 0x70, 0x5f, 0x6f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x5a, 0xd, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x5a, 0xd, 0xa, 0x3, 0x6d, 0x61, 0x78, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, /* &ir.NodeProto{ - Input: []string{"x"}, + Input: []string{"x", "min", "max"}, Output: []string{"y"}, Name: "", OpType: "Clip", - Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000118c00)(name:"max" type:FLOAT f:5 ), - (*ir.AttributeProto)(0xc000118d00)(name:"min" type:FLOAT f:-5 ) - } + Attributes: ([]*ir.AttributeProto) , }, @@ -41,6 +142,16 @@ func NewTestClipOutbounds() *testbackend.TestCase { tensor.WithShape(3), tensor.WithBacking([]float32{-6, 0, 6}), ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{-5}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{5}), + ), }, ExpectedOutput: []tensor.Tensor{ diff --git a/backend/testbackend/onnx/onnx_test_clip_splitbounds.go b/backend/testbackend/onnx/onnx_test_clip_splitbounds.go index d635c5db..6d741889 100644 --- a/backend/testbackend/onnx/onnx_test_clip_splitbounds.go +++ b/backend/testbackend/onnx/onnx_test_clip_splitbounds.go @@ -11,24 +11,125 @@ func init() { testbackend.Register("Clip", "TestClipSplitbounds", NewTestClipSplitbounds) } -// NewTestClipSplitbounds version: 3. +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "min", "max"}, + Output: {"y"}, + Name: "", + OpType: "Clip", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_clip_splitbounds", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "min", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "max", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestClipSplitbounds version: 5. func NewTestClipSplitbounds() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "Clip", Title: "TestClipSplitbounds", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x65, 0xa, 0x2a, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x4, 0x43, 0x6c, 0x69, 0x70, 0x2a, 0xd, 0xa, 0x3, 0x6d, 0x61, 0x78, 0x15, 0x0, 0x0, 0xa0, 0x40, 0xa0, 0x1, 0x1, 0x2a, 0xd, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0x15, 0x0, 0x0, 0xa0, 0xc0, 0xa0, 0x1, 0x1, 0x12, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6c, 0x69, 0x70, 0x5f, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x6f, 0xa, 0x16, 0xa, 0x1, 0x78, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0xa, 0x3, 0x6d, 0x61, 0x78, 0x12, 0x1, 0x79, 0x22, 0x4, 0x43, 0x6c, 0x69, 0x70, 0x12, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6c, 0x69, 0x70, 0x5f, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x5a, 0xd, 0xa, 0x3, 0x6d, 0x69, 0x6e, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x5a, 0xd, 0xa, 0x3, 0x6d, 0x61, 0x78, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, /* &ir.NodeProto{ - Input: []string{"x"}, + Input: []string{"x", "min", "max"}, Output: []string{"y"}, Name: "", OpType: "Clip", - Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000274000)(name:"max" type:FLOAT f:5 ), - (*ir.AttributeProto)(0xc000274100)(name:"min" type:FLOAT f:-5 ) - } + Attributes: ([]*ir.AttributeProto) , }, @@ -41,6 +142,16 @@ func NewTestClipSplitbounds() *testbackend.TestCase { tensor.WithShape(3), tensor.WithBacking([]float32{-1, 0, 6}), ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{-5}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{5}), + ), }, ExpectedOutput: []tensor.Tensor{ diff --git a/backend/testbackend/onnx/onnx_test_concat_1d_axis_0.go b/backend/testbackend/onnx/onnx_test_concat_1d_axis_0.go index ff38f5d1..caa4b2f7 100644 --- a/backend/testbackend/onnx/onnx_test_concat_1d_axis_0.go +++ b/backend/testbackend/onnx/onnx_test_concat_1d_axis_0.go @@ -11,6 +11,123 @@ func init() { testbackend.Register("Concat", "TestConcat1dAxis0", NewTestConcat1dAxis0) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"value0", "value1"}, + Output: {"output"}, + Name: "", + OpType: "Concat", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_concat_1d_axis_0", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "value0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "value1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConcat1dAxis0 version: 3. func NewTestConcat1dAxis0() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +143,7 @@ func NewTestConcat1dAxis0() *testbackend.TestCase { Name: "", OpType: "Concat", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000119000)(name:"axis" type:INT ) + (*ir.AttributeProto)(0xc0001e6400)(name:"axis" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_concat_1d_axis_negative_1.go b/backend/testbackend/onnx/onnx_test_concat_1d_axis_negative_1.go new file mode 100644 index 00000000..d59e3919 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_concat_1d_axis_negative_1.go @@ -0,0 +1,174 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Concat", "TestConcat1dAxisNegative1", NewTestConcat1dAxisNegative1) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"value0", "value1"}, + Output: {"output"}, + Name: "", + OpType: "Concat", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_concat_1d_axis_negative_1", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "value0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "value1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestConcat1dAxisNegative1 version: 6. +func NewTestConcat1dAxisNegative1() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Concat", + Title: "TestConcat1dAxisNegative1", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x9a, 0x1, 0xa, 0x36, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x30, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x12, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0x6, 0x43, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x5f, 0x31, 0x64, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x31, 0x5a, 0x14, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x30, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x14, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x62, 0x14, 0xa, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"value0", "value1"}, + Output: []string{"output"}, + Name: "", + OpType: "Concat", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0001e6700)(name:"axis" type:INT i:-1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2), + tensor.WithBacking([]float32{1, 2}), + ), + + tensor.New( + tensor.WithShape(2), + tensor.WithBacking([]float32{3, 4}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(4), + tensor.WithBacking([]float32{1, 2, 3, 4}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_concat_1d_axis_negative_1_test.go b/backend/testbackend/onnx/onnx_test_concat_1d_axis_negative_1_test.go new file mode 100644 index 00000000..783eae89 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_concat_1d_axis_negative_1_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestConcat1dAxisNegative1(t *testing.T) { + mytest := NewTestConcat1dAxisNegative1() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_concat_2d_axis_0.go b/backend/testbackend/onnx/onnx_test_concat_2d_axis_0.go index c2442fff..35a4747b 100644 --- a/backend/testbackend/onnx/onnx_test_concat_2d_axis_0.go +++ b/backend/testbackend/onnx/onnx_test_concat_2d_axis_0.go @@ -11,6 +11,135 @@ func init() { testbackend.Register("Concat", "TestConcat2dAxis0", NewTestConcat2dAxis0) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"value0", "value1"}, + Output: {"output"}, + Name: "", + OpType: "Concat", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_concat_2d_axis_0", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "value0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "value1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConcat2dAxis0 version: 3. func NewTestConcat2dAxis0() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +155,7 @@ func NewTestConcat2dAxis0() *testbackend.TestCase { Name: "", OpType: "Concat", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000274700)(name:"axis" type:INT ) + (*ir.AttributeProto)(0xc000216d00)(name:"axis" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_concat_2d_axis_1.go b/backend/testbackend/onnx/onnx_test_concat_2d_axis_1.go index 1789be4c..4562b440 100644 --- a/backend/testbackend/onnx/onnx_test_concat_2d_axis_1.go +++ b/backend/testbackend/onnx/onnx_test_concat_2d_axis_1.go @@ -11,6 +11,135 @@ func init() { testbackend.Register("Concat", "TestConcat2dAxis1", NewTestConcat2dAxis1) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"value0", "value1"}, + Output: {"output"}, + Name: "", + OpType: "Concat", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_concat_2d_axis_1", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "value0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "value1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConcat2dAxis1 version: 3. func NewTestConcat2dAxis1() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +155,7 @@ func NewTestConcat2dAxis1() *testbackend.TestCase { Name: "", OpType: "Concat", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000274800)(name:"axis" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217000)(name:"axis" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_concat_2d_axis_negative_1.go b/backend/testbackend/onnx/onnx_test_concat_2d_axis_negative_1.go new file mode 100644 index 00000000..7cec43a3 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_concat_2d_axis_negative_1.go @@ -0,0 +1,186 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Concat", "TestConcat2dAxisNegative1", NewTestConcat2dAxisNegative1) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"value0", "value1"}, + Output: {"output"}, + Name: "", + OpType: "Concat", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_concat_2d_axis_negative_1", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "value0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "value1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestConcat2dAxisNegative1 version: 6. +func NewTestConcat2dAxisNegative1() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Concat", + Title: "TestConcat2dAxisNegative1", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xa6, 0x1, 0xa, 0x36, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x30, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x12, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0x6, 0x43, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x5f, 0x32, 0x64, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x31, 0x5a, 0x18, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x30, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x18, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x18, 0xa, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"value0", "value1"}, + Output: []string{"output"}, + Name: "", + OpType: "Concat", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217300)(name:"axis" type:INT i:-1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{1, 2, 3, 4}), + ), + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{5, 6, 7, 8}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 4), + tensor.WithBacking([]float32{1, 2, 5, 6, 3, 4, 7, 8}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_concat_2d_axis_negative_1_test.go b/backend/testbackend/onnx/onnx_test_concat_2d_axis_negative_1_test.go new file mode 100644 index 00000000..21c2c1ae --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_concat_2d_axis_negative_1_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestConcat2dAxisNegative1(t *testing.T) { + mytest := NewTestConcat2dAxisNegative1() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_concat_2d_axis_negative_2.go b/backend/testbackend/onnx/onnx_test_concat_2d_axis_negative_2.go new file mode 100644 index 00000000..ad63bd03 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_concat_2d_axis_negative_2.go @@ -0,0 +1,186 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Concat", "TestConcat2dAxisNegative2", NewTestConcat2dAxisNegative2) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"value0", "value1"}, + Output: {"output"}, + Name: "", + OpType: "Concat", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_concat_2d_axis_negative_2", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "value0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "value1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestConcat2dAxisNegative2 version: 6. +func NewTestConcat2dAxisNegative2() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Concat", + Title: "TestConcat2dAxisNegative2", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xa6, 0x1, 0xa, 0x36, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x30, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x12, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0x6, 0x43, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x5f, 0x32, 0x64, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x32, 0x5a, 0x18, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x30, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x18, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x18, 0xa, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"value0", "value1"}, + Output: []string{"output"}, + Name: "", + OpType: "Concat", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217600)(name:"axis" type:INT i:-2 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{1, 2, 3, 4}), + ), + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{5, 6, 7, 8}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(4, 2), + tensor.WithBacking([]float32{1, 2, 3, 4, 5, 6, 7, 8}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_concat_2d_axis_negative_2_test.go b/backend/testbackend/onnx/onnx_test_concat_2d_axis_negative_2_test.go new file mode 100644 index 00000000..b92b0f0c --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_concat_2d_axis_negative_2_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestConcat2dAxisNegative2(t *testing.T) { + mytest := NewTestConcat2dAxisNegative2() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_concat_3d_axis_0.go b/backend/testbackend/onnx/onnx_test_concat_3d_axis_0.go index 02856cba..c0690b97 100644 --- a/backend/testbackend/onnx/onnx_test_concat_3d_axis_0.go +++ b/backend/testbackend/onnx/onnx_test_concat_3d_axis_0.go @@ -11,6 +11,147 @@ func init() { testbackend.Register("Concat", "TestConcat3dAxis0", NewTestConcat3dAxis0) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"value0", "value1"}, + Output: {"output"}, + Name: "", + OpType: "Concat", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_concat_3d_axis_0", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "value0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "value1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConcat3dAxis0 version: 3. func NewTestConcat3dAxis0() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +167,7 @@ func NewTestConcat3dAxis0() *testbackend.TestCase { Name: "", OpType: "Concat", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000274900)(name:"axis" type:INT ) + (*ir.AttributeProto)(0xc000217a00)(name:"axis" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_concat_3d_axis_1.go b/backend/testbackend/onnx/onnx_test_concat_3d_axis_1.go index 5b4cd28b..39df229a 100644 --- a/backend/testbackend/onnx/onnx_test_concat_3d_axis_1.go +++ b/backend/testbackend/onnx/onnx_test_concat_3d_axis_1.go @@ -11,6 +11,147 @@ func init() { testbackend.Register("Concat", "TestConcat3dAxis1", NewTestConcat3dAxis1) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"value0", "value1"}, + Output: {"output"}, + Name: "", + OpType: "Concat", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_concat_3d_axis_1", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "value0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "value1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConcat3dAxis1 version: 3. func NewTestConcat3dAxis1() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +167,7 @@ func NewTestConcat3dAxis1() *testbackend.TestCase { Name: "", OpType: "Concat", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc0003a0200)(name:"axis" type:INT i:1 ) + (*ir.AttributeProto)(0xc000216d00)(name:"axis" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_concat_3d_axis_2.go b/backend/testbackend/onnx/onnx_test_concat_3d_axis_2.go index 7577ff25..4c3866cf 100644 --- a/backend/testbackend/onnx/onnx_test_concat_3d_axis_2.go +++ b/backend/testbackend/onnx/onnx_test_concat_3d_axis_2.go @@ -11,6 +11,147 @@ func init() { testbackend.Register("Concat", "TestConcat3dAxis2", NewTestConcat3dAxis2) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"value0", "value1"}, + Output: {"output"}, + Name: "", + OpType: "Concat", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_concat_3d_axis_2", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "value0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "value1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConcat3dAxis2 version: 3. func NewTestConcat3dAxis2() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +167,7 @@ func NewTestConcat3dAxis2() *testbackend.TestCase { Name: "", OpType: "Concat", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc0003a0300)(name:"axis" type:INT i:2 ) + (*ir.AttributeProto)(0xc000217100)(name:"axis" type:INT i:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_1.go b/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_1.go new file mode 100644 index 00000000..7e4c0d44 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_1.go @@ -0,0 +1,198 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Concat", "TestConcat3dAxisNegative1", NewTestConcat3dAxisNegative1) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"value0", "value1"}, + Output: {"output"}, + Name: "", + OpType: "Concat", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_concat_3d_axis_negative_1", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "value0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "value1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestConcat3dAxisNegative1 version: 6. +func NewTestConcat3dAxisNegative1() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Concat", + Title: "TestConcat3dAxisNegative1", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xb2, 0x1, 0xa, 0x36, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x30, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x12, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0x6, 0x43, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x5f, 0x33, 0x64, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x31, 0x5a, 0x1c, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x30, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x1c, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1c, 0xa, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"value0", "value1"}, + Output: []string{"output"}, + Name: "", + OpType: "Concat", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0001e6600)(name:"axis" type:INT i:-1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2, 2), + tensor.WithBacking([]float32{1, 2, 3, 4, 5, 6, 7, 8}), + ), + + tensor.New( + tensor.WithShape(2, 2, 2), + tensor.WithBacking([]float32{9, 10, 11, 12, 13, 14, 15, 16}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2, 4), + tensor.WithBacking([]float32{1, 2, 9, 10, 3, 4, 11, 12, 5, 6, 13, 14, 7, 8, 15, 16}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_1_test.go b/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_1_test.go new file mode 100644 index 00000000..4724bb74 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_1_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestConcat3dAxisNegative1(t *testing.T) { + mytest := NewTestConcat3dAxisNegative1() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_2.go b/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_2.go new file mode 100644 index 00000000..5bf24734 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_2.go @@ -0,0 +1,198 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Concat", "TestConcat3dAxisNegative2", NewTestConcat3dAxisNegative2) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"value0", "value1"}, + Output: {"output"}, + Name: "", + OpType: "Concat", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_concat_3d_axis_negative_2", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "value0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "value1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestConcat3dAxisNegative2 version: 6. +func NewTestConcat3dAxisNegative2() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Concat", + Title: "TestConcat3dAxisNegative2", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xb2, 0x1, 0xa, 0x36, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x30, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x12, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0x6, 0x43, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x5f, 0x33, 0x64, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x32, 0x5a, 0x1c, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x30, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x1c, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1c, 0xa, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"value0", "value1"}, + Output: []string{"output"}, + Name: "", + OpType: "Concat", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0002fa200)(name:"axis" type:INT i:-2 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2, 2), + tensor.WithBacking([]float32{1, 2, 3, 4, 5, 6, 7, 8}), + ), + + tensor.New( + tensor.WithShape(2, 2, 2), + tensor.WithBacking([]float32{9, 10, 11, 12, 13, 14, 15, 16}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 4, 2), + tensor.WithBacking([]float32{1, 2, 3, 4, 9, 10, 11, 12, 5, 6, 7, 8, 13, 14, 15, 16}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_2_test.go b/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_2_test.go new file mode 100644 index 00000000..f05f1fd4 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_2_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestConcat3dAxisNegative2(t *testing.T) { + mytest := NewTestConcat3dAxisNegative2() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_3.go b/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_3.go new file mode 100644 index 00000000..ec0560a3 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_3.go @@ -0,0 +1,198 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Concat", "TestConcat3dAxisNegative3", NewTestConcat3dAxisNegative3) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"value0", "value1"}, + Output: {"output"}, + Name: "", + OpType: "Concat", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -3, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_concat_3d_axis_negative_3", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "value0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "value1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestConcat3dAxisNegative3 version: 6. +func NewTestConcat3dAxisNegative3() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Concat", + Title: "TestConcat3dAxisNegative3", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xb2, 0x1, 0xa, 0x36, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x30, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x12, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0x6, 0x43, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x63, 0x61, 0x74, 0x5f, 0x33, 0x64, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x33, 0x5a, 0x1c, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x30, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x1c, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x31, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1c, 0xa, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"value0", "value1"}, + Output: []string{"output"}, + Name: "", + OpType: "Concat", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0002fa600)(name:"axis" type:INT i:-3 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2, 2), + tensor.WithBacking([]float32{1, 2, 3, 4, 5, 6, 7, 8}), + ), + + tensor.New( + tensor.WithShape(2, 2, 2), + tensor.WithBacking([]float32{9, 10, 11, 12, 13, 14, 15, 16}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(4, 2, 2), + tensor.WithBacking([]float32{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_3_test.go b/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_3_test.go new file mode 100644 index 00000000..a424bdcb --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_concat_3d_axis_negative_3_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestConcat3dAxisNegative3(t *testing.T) { + mytest := NewTestConcat3dAxisNegative3() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_constant.go b/backend/testbackend/onnx/onnx_test_constant.go index 2a745274..a5744f28 100644 --- a/backend/testbackend/onnx/onnx_test_constant.go +++ b/backend/testbackend/onnx/onnx_test_constant.go @@ -11,6 +11,101 @@ func init() { testbackend.Register("Constant", "TestConstant", NewTestConstant) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: nil, + Output: {"values"}, + Name: "", + OpType: "Constant", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "value", + RefAttrName: "", + DocString: "", + Type: 4, + F: 0, + I: 0, + S: nil, + T: &ir.TensorProto{ + Dims: {5, 5}, + DataType: 1, + Segment: (*ir.TensorProto_Segment)(nil), + FloatData: {1.764052391052246, 0.40015721321105957, 0.978738009929657, 2.2408931255340576, 1.8675580024719238, -0.9772778749465942, 0.9500884413719177, -0.15135720372200012, -0.10321885347366333, 0.4105985164642334, 0.14404356479644775, 1.4542734622955322, 0.7610377073287964, 0.12167501449584961, 0.44386324286460876, 0.3336743414402008, 1.4940791130065918, -0.2051582634449005, 0.3130677044391632, -0.8540957570075989, -2.5529897212982178, 0.653618574142456, 0.8644362092018127, -0.7421650290489197, 2.269754648208618}, + Int32Data: nil, + StringData: nil, + Int64Data: nil, + Name: "const_tensor", + DocString: "", + RawData: nil, + ExternalData: nil, + DataLocation: 0, + DoubleData: nil, + Uint64Data: nil, + }, + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_constant", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: nil, + Output: { + &ir.ValueInfoProto{ + Name: "values", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConstant version: 3. func NewTestConstant() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +121,7 @@ func NewTestConstant() *testbackend.TestCase { Name: "", OpType: "Constant", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc0003a0900)(name:"value" type:TENSOR t: ) + (*ir.AttributeProto)(0xc0002faa00)(name:"value" type:TENSOR t: ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_constant_pad.go b/backend/testbackend/onnx/onnx_test_constant_pad.go index b9ef2b9f..faca5609 100644 --- a/backend/testbackend/onnx/onnx_test_constant_pad.go +++ b/backend/testbackend/onnx/onnx_test_constant_pad.go @@ -11,24 +11,176 @@ func init() { testbackend.Register("Pad", "TestConstantPad", NewTestConstantPad) } -// NewTestConstantPad version: 3. +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "pads", "value"}, + Output: {"y"}, + Name: "", + OpType: "Pad", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "mode", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_constant_pad", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "pads", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:8}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "value", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:12}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestConstantPad version: 6. func NewTestConstantPad() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "Pad", Title: "TestConstantPad", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x9b, 0x1, 0xa, 0x4c, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x3, 0x50, 0x61, 0x64, 0x2a, 0x13, 0xa, 0x4, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x8, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0xa0, 0x1, 0x3, 0x2a, 0x19, 0xa, 0x4, 0x70, 0x61, 0x64, 0x73, 0x40, 0x0, 0x40, 0x0, 0x40, 0x1, 0x40, 0x3, 0x40, 0x0, 0x40, 0x0, 0x40, 0x2, 0x40, 0x4, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x15, 0x9a, 0x99, 0x99, 0x3f, 0xa0, 0x1, 0x1, 0x12, 0x11, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x5f, 0x70, 0x61, 0x64, 0x5a, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x7, 0xa, 0x2, 0x8, 0xc, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xa1, 0x1, 0xa, 0x2d, 0xa, 0x1, 0x78, 0xa, 0x4, 0x70, 0x61, 0x64, 0x73, 0xa, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1, 0x79, 0x22, 0x3, 0x50, 0x61, 0x64, 0x2a, 0x13, 0xa, 0x4, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x8, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0xa0, 0x1, 0x3, 0x12, 0x11, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x5f, 0x70, 0x61, 0x64, 0x5a, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x5a, 0x12, 0xa, 0x4, 0x70, 0x61, 0x64, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x8, 0x5a, 0xf, 0xa, 0x5, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x7, 0xa, 0x2, 0x8, 0xc, 0x42, 0x2, 0x10, 0xb}, /* &ir.NodeProto{ - Input: []string{"x"}, + Input: []string{"x", "pads", "value"}, Output: []string{"y"}, Name: "", OpType: "Pad", - Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { - (*ir.AttributeProto)(0xc0003a0b00)(name:"mode" type:STRING s:"constant" ), - (*ir.AttributeProto)(0xc0003a0c00)(name:"pads" type:INTS ints:0 ints:0 ints:1 ints:3 ints:0 ints:0 ints:2 ints:4 ), - (*ir.AttributeProto)(0xc0003a0d00)(name:"value" type:FLOAT f:1.2 ) + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0001e6500)(name:"mode" type:STRING s:"constant" ) } , }, @@ -42,6 +194,16 @@ func NewTestConstantPad() *testbackend.TestCase { tensor.WithShape(1, 3, 4, 5), tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), ), + + tensor.New( + tensor.WithShape(8), + tensor.WithBacking([]int64{0, 0, 1, 3, 0, 0, 2, 4}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{1.2}), + ), }, ExpectedOutput: []tensor.Tensor{ diff --git a/backend/testbackend/onnx/onnx_test_constantofshape_float_ones.go b/backend/testbackend/onnx/onnx_test_constantofshape_float_ones.go index 9d48e5ea..93e48d49 100644 --- a/backend/testbackend/onnx/onnx_test_constantofshape_float_ones.go +++ b/backend/testbackend/onnx/onnx_test_constantofshape_float_ones.go @@ -11,6 +11,126 @@ func init() { testbackend.Register("ConstantOfShape", "TestConstantofshapeFloatOnes", NewTestConstantofshapeFloatOnes) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "ConstantOfShape", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "value", + RefAttrName: "", + DocString: "", + Type: 4, + F: 0, + I: 0, + S: nil, + T: &ir.TensorProto{ + Dims: {1}, + DataType: 1, + Segment: (*ir.TensorProto_Segment)(nil), + FloatData: {1}, + Int32Data: nil, + StringData: nil, + Int64Data: nil, + Name: "value", + DocString: "", + RawData: nil, + ExternalData: nil, + DataLocation: 0, + DoubleData: nil, + Uint64Data: nil, + }, + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_constantofshape_float_ones", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConstantofshapeFloatOnes version: 4. func NewTestConstantofshapeFloatOnes() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +146,7 @@ func NewTestConstantofshapeFloatOnes() *testbackend.TestCase { Name: "", OpType: "ConstantOfShape", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000132400)(name:"value" type:TENSOR t: ) + (*ir.AttributeProto)(0xc0002fa200)(name:"value" type:TENSOR t: ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_constantofshape_int_zeros.go b/backend/testbackend/onnx/onnx_test_constantofshape_int_zeros.go index fbed350b..045f8290 100644 --- a/backend/testbackend/onnx/onnx_test_constantofshape_int_zeros.go +++ b/backend/testbackend/onnx/onnx_test_constantofshape_int_zeros.go @@ -11,6 +11,122 @@ func init() { testbackend.Register("ConstantOfShape", "TestConstantofshapeIntZeros", NewTestConstantofshapeIntZeros) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "ConstantOfShape", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "value", + RefAttrName: "", + DocString: "", + Type: 4, + F: 0, + I: 0, + S: nil, + T: &ir.TensorProto{ + Dims: {1}, + DataType: 6, + Segment: (*ir.TensorProto_Segment)(nil), + FloatData: nil, + Int32Data: {0}, + StringData: nil, + Int64Data: nil, + Name: "value", + DocString: "", + RawData: nil, + ExternalData: nil, + DataLocation: 0, + DoubleData: nil, + Uint64Data: nil, + }, + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_constantofshape_int_zeros", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConstantofshapeIntZeros version: 4. func NewTestConstantofshapeIntZeros() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +142,7 @@ func NewTestConstantofshapeIntZeros() *testbackend.TestCase { Name: "", OpType: "ConstantOfShape", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000132900)(name:"value" type:TENSOR t: ) + (*ir.AttributeProto)(0xc0002fa600)(name:"value" type:TENSOR t: ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_conv_with_strides_and_asymmetric_padding.go b/backend/testbackend/onnx/onnx_test_conv_with_strides_and_asymmetric_padding.go index d7959c87..8546d175 100644 --- a/backend/testbackend/onnx/onnx_test_conv_with_strides_and_asymmetric_padding.go +++ b/backend/testbackend/onnx/onnx_test_conv_with_strides_and_asymmetric_padding.go @@ -11,6 +11,195 @@ func init() { testbackend.Register("Conv", "TestConvWithStridesAndAsymmetricPadding", NewTestConvWithStridesAndAsymmetricPadding) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "W"}, + Output: {"y"}, + Name: "", + OpType: "Conv", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 3}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pads", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1, 0, 1, 0}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_conv_with_strides_and_asymmetric_padding", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "W", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConvWithStridesAndAsymmetricPadding version: 3. func NewTestConvWithStridesAndAsymmetricPadding() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,9 +215,9 @@ func NewTestConvWithStridesAndAsymmetricPadding() *testbackend.TestCase { Name: "", OpType: "Conv", Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { - (*ir.AttributeProto)(0xc000126000)(name:"kernel_shape" type:INTS ints:3 ints:3 ), - (*ir.AttributeProto)(0xc000126100)(name:"pads" type:INTS ints:1 ints:0 ints:1 ints:0 ), - (*ir.AttributeProto)(0xc000126300)(name:"strides" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc0002fa900)(name:"kernel_shape" type:INTS ints:3 ints:3 ), + (*ir.AttributeProto)(0xc0002fab00)(name:"pads" type:INTS ints:1 ints:0 ints:1 ints:0 ), + (*ir.AttributeProto)(0xc0002fac00)(name:"strides" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_conv_with_strides_no_padding.go b/backend/testbackend/onnx/onnx_test_conv_with_strides_no_padding.go index 2f89702a..c4b1ce26 100644 --- a/backend/testbackend/onnx/onnx_test_conv_with_strides_no_padding.go +++ b/backend/testbackend/onnx/onnx_test_conv_with_strides_no_padding.go @@ -11,6 +11,195 @@ func init() { testbackend.Register("Conv", "TestConvWithStridesNoPadding", NewTestConvWithStridesNoPadding) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "W"}, + Output: {"y"}, + Name: "", + OpType: "Conv", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 3}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pads", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 0, 0, 0}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_conv_with_strides_no_padding", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "W", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConvWithStridesNoPadding version: 3. func NewTestConvWithStridesNoPadding() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,9 +215,9 @@ func NewTestConvWithStridesNoPadding() *testbackend.TestCase { Name: "", OpType: "Conv", Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { - (*ir.AttributeProto)(0xc000133400)(name:"kernel_shape" type:INTS ints:3 ints:3 ), - (*ir.AttributeProto)(0xc000133500)(name:"pads" type:INTS ints:0 ints:0 ints:0 ints:0 ), - (*ir.AttributeProto)(0xc000133600)(name:"strides" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc0002fb100)(name:"kernel_shape" type:INTS ints:3 ints:3 ), + (*ir.AttributeProto)(0xc0002fb200)(name:"pads" type:INTS ints:0 ints:0 ints:0 ints:0 ), + (*ir.AttributeProto)(0xc0002fb300)(name:"strides" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_conv_with_strides_padding.go b/backend/testbackend/onnx/onnx_test_conv_with_strides_padding.go index cfd9ede3..79df8443 100644 --- a/backend/testbackend/onnx/onnx_test_conv_with_strides_padding.go +++ b/backend/testbackend/onnx/onnx_test_conv_with_strides_padding.go @@ -11,6 +11,195 @@ func init() { testbackend.Register("Conv", "TestConvWithStridesPadding", NewTestConvWithStridesPadding) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "W"}, + Output: {"y"}, + Name: "", + OpType: "Conv", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 3}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pads", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1, 1, 1, 1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_conv_with_strides_padding", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "W", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConvWithStridesPadding version: 3. func NewTestConvWithStridesPadding() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,9 +215,9 @@ func NewTestConvWithStridesPadding() *testbackend.TestCase { Name: "", OpType: "Conv", Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { - (*ir.AttributeProto)(0xc000126500)(name:"kernel_shape" type:INTS ints:3 ints:3 ), - (*ir.AttributeProto)(0xc000126600)(name:"pads" type:INTS ints:1 ints:1 ints:1 ints:1 ), - (*ir.AttributeProto)(0xc000126700)(name:"strides" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc0001e6100)(name:"kernel_shape" type:INTS ints:3 ints:3 ), + (*ir.AttributeProto)(0xc0001e6400)(name:"pads" type:INTS ints:1 ints:1 ints:1 ints:1 ), + (*ir.AttributeProto)(0xc0001e6500)(name:"strides" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_convtranspose.go b/backend/testbackend/onnx/onnx_test_convtranspose.go index 35396708..61764998 100644 --- a/backend/testbackend/onnx/onnx_test_convtranspose.go +++ b/backend/testbackend/onnx/onnx_test_convtranspose.go @@ -11,6 +11,140 @@ func init() { testbackend.Register("ConvTranspose", "TestConvtranspose", NewTestConvtranspose) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X", "W"}, + Output: {"Y"}, + Name: "", + OpType: "ConvTranspose", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_convtranspose", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "W", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConvtranspose version: 3. func NewTestConvtranspose() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_convtranspose_1d.go b/backend/testbackend/onnx/onnx_test_convtranspose_1d.go index c28d83d8..7e00b12d 100644 --- a/backend/testbackend/onnx/onnx_test_convtranspose_1d.go +++ b/backend/testbackend/onnx/onnx_test_convtranspose_1d.go @@ -11,6 +11,128 @@ func init() { testbackend.Register("ConvTranspose", "TestConvtranspose1d", NewTestConvtranspose1d) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X", "W"}, + Output: {"Y"}, + Name: "", + OpType: "ConvTranspose", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_convtranspose_1d", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "W", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConvtranspose1d version: 3. func NewTestConvtranspose1d() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_convtranspose_3d.go b/backend/testbackend/onnx/onnx_test_convtranspose_3d.go index 2da9c2b7..51c22731 100644 --- a/backend/testbackend/onnx/onnx_test_convtranspose_3d.go +++ b/backend/testbackend/onnx/onnx_test_convtranspose_3d.go @@ -11,6 +11,152 @@ func init() { testbackend.Register("ConvTranspose", "TestConvtranspose3d", NewTestConvtranspose3d) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X", "W"}, + Output: {"Y"}, + Name: "", + OpType: "ConvTranspose", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_convtranspose_3d", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "W", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConvtranspose3d version: 3. func NewTestConvtranspose3d() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_convtranspose_dilations.go b/backend/testbackend/onnx/onnx_test_convtranspose_dilations.go index 7f55fecb..7f4f089a 100644 --- a/backend/testbackend/onnx/onnx_test_convtranspose_dilations.go +++ b/backend/testbackend/onnx/onnx_test_convtranspose_dilations.go @@ -11,6 +11,159 @@ func init() { testbackend.Register("ConvTranspose", "TestConvtransposeDilations", NewTestConvtransposeDilations) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X", "W"}, + Output: {"Y"}, + Name: "", + OpType: "ConvTranspose", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "dilations", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_convtranspose_dilations", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "W", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConvtransposeDilations version: 4. func NewTestConvtransposeDilations() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +179,7 @@ func NewTestConvtransposeDilations() *testbackend.TestCase { Name: "", OpType: "ConvTranspose", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000118d00)(name:"dilations" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc0001e6100)(name:"dilations" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_convtranspose_kernel_shape.go b/backend/testbackend/onnx/onnx_test_convtranspose_kernel_shape.go index 1c555b70..9d069c7c 100644 --- a/backend/testbackend/onnx/onnx_test_convtranspose_kernel_shape.go +++ b/backend/testbackend/onnx/onnx_test_convtranspose_kernel_shape.go @@ -11,6 +11,213 @@ func init() { testbackend.Register("ConvTranspose", "TestConvtransposeKernelShape", NewTestConvtransposeKernelShape) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X", "W"}, + Output: {"Y"}, + Name: "test", + OpType: "ConvTranspose", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 3}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "output_padding", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1, 1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "output_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {10, 8}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_convtranspose_kernel_shape", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "W", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:8}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConvtransposeKernelShape version: 3. func NewTestConvtransposeKernelShape() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,10 +233,10 @@ func NewTestConvtransposeKernelShape() *testbackend.TestCase { Name: "test", OpType: "ConvTranspose", Attributes: ([]*ir.AttributeProto) (len=4 cap=4) { - (*ir.AttributeProto)(0xc000127b00)(name:"kernel_shape" type:INTS ints:3 ints:3 ), - (*ir.AttributeProto)(0xc000127c00)(name:"output_padding" type:INTS ints:1 ints:1 ), - (*ir.AttributeProto)(0xc000127d00)(name:"output_shape" type:INTS ints:10 ints:8 ), - (*ir.AttributeProto)(0xc000127e00)(name:"strides" type:INTS ints:3 ints:2 ) + (*ir.AttributeProto)(0xc000314000)(name:"kernel_shape" type:INTS ints:3 ints:3 ), + (*ir.AttributeProto)(0xc000314100)(name:"output_padding" type:INTS ints:1 ints:1 ), + (*ir.AttributeProto)(0xc000314200)(name:"output_shape" type:INTS ints:10 ints:8 ), + (*ir.AttributeProto)(0xc000314300)(name:"strides" type:INTS ints:3 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_convtranspose_output_shape.go b/backend/testbackend/onnx/onnx_test_convtranspose_output_shape.go index 176c33db..b191c09a 100644 --- a/backend/testbackend/onnx/onnx_test_convtranspose_output_shape.go +++ b/backend/testbackend/onnx/onnx_test_convtranspose_output_shape.go @@ -11,6 +11,177 @@ func init() { testbackend.Register("ConvTranspose", "TestConvtransposeOutputShape", NewTestConvtransposeOutputShape) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X", "W"}, + Output: {"Y"}, + Name: "", + OpType: "ConvTranspose", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "output_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {10, 8}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_convtranspose_output_shape", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "W", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:8}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConvtransposeOutputShape version: 3. func NewTestConvtransposeOutputShape() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +197,8 @@ func NewTestConvtransposeOutputShape() *testbackend.TestCase { Name: "", OpType: "ConvTranspose", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc00045a600)(name:"output_shape" type:INTS ints:10 ints:8 ), - (*ir.AttributeProto)(0xc00045a700)(name:"strides" type:INTS ints:3 ints:2 ) + (*ir.AttributeProto)(0xc000314a00)(name:"output_shape" type:INTS ints:10 ints:8 ), + (*ir.AttributeProto)(0xc000314b00)(name:"strides" type:INTS ints:3 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_convtranspose_pad.go b/backend/testbackend/onnx/onnx_test_convtranspose_pad.go index 13db0ac8..d329eeac 100644 --- a/backend/testbackend/onnx/onnx_test_convtranspose_pad.go +++ b/backend/testbackend/onnx/onnx_test_convtranspose_pad.go @@ -11,6 +11,177 @@ func init() { testbackend.Register("ConvTranspose", "TestConvtransposePad", NewTestConvtransposePad) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X", "W"}, + Output: {"Y"}, + Name: "", + OpType: "ConvTranspose", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "output_padding", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1, 1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_convtranspose_pad", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "W", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:8}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConvtransposePad version: 3. func NewTestConvtransposePad() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +197,8 @@ func NewTestConvtransposePad() *testbackend.TestCase { Name: "", OpType: "ConvTranspose", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000118e00)(name:"output_padding" type:INTS ints:1 ints:1 ), - (*ir.AttributeProto)(0xc000118f00)(name:"strides" type:INTS ints:3 ints:2 ) + (*ir.AttributeProto)(0xc000315200)(name:"output_padding" type:INTS ints:1 ints:1 ), + (*ir.AttributeProto)(0xc000315300)(name:"strides" type:INTS ints:3 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_convtranspose_pads.go b/backend/testbackend/onnx/onnx_test_convtranspose_pads.go index 72fb0977..7225c856 100644 --- a/backend/testbackend/onnx/onnx_test_convtranspose_pads.go +++ b/backend/testbackend/onnx/onnx_test_convtranspose_pads.go @@ -11,6 +11,177 @@ func init() { testbackend.Register("ConvTranspose", "TestConvtransposePads", NewTestConvtransposePads) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X", "W"}, + Output: {"Y"}, + Name: "", + OpType: "ConvTranspose", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "pads", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1, 2, 1, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_convtranspose_pads", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "W", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConvtransposePads version: 3. func NewTestConvtransposePads() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +197,8 @@ func NewTestConvtransposePads() *testbackend.TestCase { Name: "", OpType: "ConvTranspose", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc00045b100)(name:"pads" type:INTS ints:1 ints:2 ints:1 ints:2 ), - (*ir.AttributeProto)(0xc00045b200)(name:"strides" type:INTS ints:3 ints:2 ) + (*ir.AttributeProto)(0xc0001e6100)(name:"pads" type:INTS ints:1 ints:2 ints:1 ints:2 ), + (*ir.AttributeProto)(0xc0001e6400)(name:"strides" type:INTS ints:3 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_convtranspose_with_kernel.go b/backend/testbackend/onnx/onnx_test_convtranspose_with_kernel.go index b8cbdf0d..3ba22d3f 100644 --- a/backend/testbackend/onnx/onnx_test_convtranspose_with_kernel.go +++ b/backend/testbackend/onnx/onnx_test_convtranspose_with_kernel.go @@ -11,6 +11,213 @@ func init() { testbackend.Register("ConvTranspose", "TestConvtransposeWithKernel", NewTestConvtransposeWithKernel) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:8}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "w"}, + Output: {"y"}, + Name: "test", + OpType: "ConvTranspose", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 3}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "output_padding", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1, 1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "output_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {10, 8}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_convtranspose_with_kernel", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "w", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:8}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestConvtransposeWithKernel version: 3. func NewTestConvtransposeWithKernel() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,10 +233,10 @@ func NewTestConvtransposeWithKernel() *testbackend.TestCase { Name: "test", OpType: "ConvTranspose", Attributes: ([]*ir.AttributeProto) (len=4 cap=4) { - (*ir.AttributeProto)(0xc00045bb00)(name:"kernel_shape" type:INTS ints:3 ints:3 ), - (*ir.AttributeProto)(0xc00045bc00)(name:"output_padding" type:INTS ints:1 ints:1 ), - (*ir.AttributeProto)(0xc00045bd00)(name:"output_shape" type:INTS ints:10 ints:8 ), - (*ir.AttributeProto)(0xc00045be00)(name:"strides" type:INTS ints:3 ints:2 ) + (*ir.AttributeProto)(0xc000314300)(name:"kernel_shape" type:INTS ints:3 ints:3 ), + (*ir.AttributeProto)(0xc000314400)(name:"output_padding" type:INTS ints:1 ints:1 ), + (*ir.AttributeProto)(0xc000314500)(name:"output_shape" type:INTS ints:10 ints:8 ), + (*ir.AttributeProto)(0xc000314600)(name:"strides" type:INTS ints:3 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_cos.go b/backend/testbackend/onnx/onnx_test_cos.go index 1595bea0..808cd162 100644 --- a/backend/testbackend/onnx/onnx_test_cos.go +++ b/backend/testbackend/onnx/onnx_test_cos.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Cos", "TestCos", NewTestCos) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Cos", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_cos", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestCos version: 3. func NewTestCos() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_cos_example.go b/backend/testbackend/onnx/onnx_test_cos_example.go index 92fc2243..d3c8a78d 100644 --- a/backend/testbackend/onnx/onnx_test_cos_example.go +++ b/backend/testbackend/onnx/onnx_test_cos_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Cos", "TestCosExample", NewTestCosExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Cos", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_cos_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestCosExample version: 3. func NewTestCosExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_cosh.go b/backend/testbackend/onnx/onnx_test_cosh.go index affe1fe3..9c3f7943 100644 --- a/backend/testbackend/onnx/onnx_test_cosh.go +++ b/backend/testbackend/onnx/onnx_test_cosh.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Cosh", "TestCosh", NewTestCosh) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Cosh", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_cosh", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestCosh version: 3. func NewTestCosh() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_cosh_example.go b/backend/testbackend/onnx/onnx_test_cosh_example.go index 8343b83c..4d30701b 100644 --- a/backend/testbackend/onnx/onnx_test_cosh_example.go +++ b/backend/testbackend/onnx/onnx_test_cosh_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Cosh", "TestCoshExample", NewTestCoshExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Cosh", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_cosh_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestCoshExample version: 3. func NewTestCoshExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_cumsum_1d.go b/backend/testbackend/onnx/onnx_test_cumsum_1d.go new file mode 100644 index 00000000..ebd5ef3a --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_cumsum_1d.go @@ -0,0 +1,153 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("CumSum", "TestCumsum1d", NewTestCumsum1d) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "axis"}, + Output: {"y"}, + Name: "", + OpType: "CumSum", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_cumsum_1d", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "axis", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestCumsum1d version: 5. +func NewTestCumsum1d() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "CumSum", + Title: "TestCumsum1d", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x5c, 0xa, 0x14, 0xa, 0x1, 0x78, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x12, 0x1, 0x79, 0x22, 0x6, 0x43, 0x75, 0x6d, 0x53, 0x75, 0x6d, 0x12, 0xe, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x75, 0x6d, 0x73, 0x75, 0x6d, 0x5f, 0x31, 0x64, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0xb, 0x12, 0x4, 0xa, 0x2, 0x8, 0x5, 0x5a, 0x12, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x6, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0xb, 0x12, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x", "axis"}, + Output: []string{"y"}, + Name: "", + OpType: "CumSum", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(5), + tensor.WithBacking([]float64{1, 2, 3, 4, 5}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{0}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(5), + tensor.WithBacking([]float64{1, 3, 6, 10, 15}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_cumsum_1d_exclusive.go b/backend/testbackend/onnx/onnx_test_cumsum_1d_exclusive.go new file mode 100644 index 00000000..d36f618f --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_cumsum_1d_exclusive.go @@ -0,0 +1,174 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("CumSum", "TestCumsum1dExclusive", NewTestCumsum1dExclusive) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "axis"}, + Output: {"y"}, + Name: "", + OpType: "CumSum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "exclusive", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_cumsum_1d_exclusive", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "axis", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestCumsum1dExclusive version: 5. +func NewTestCumsum1dExclusive() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "CumSum", + Title: "TestCumsum1dExclusive", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x78, 0xa, 0x26, 0xa, 0x1, 0x78, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x12, 0x1, 0x79, 0x22, 0x6, 0x43, 0x75, 0x6d, 0x53, 0x75, 0x6d, 0x2a, 0x10, 0xa, 0x9, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x18, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x75, 0x6d, 0x73, 0x75, 0x6d, 0x5f, 0x31, 0x64, 0x5f, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0xb, 0x12, 0x4, 0xa, 0x2, 0x8, 0x5, 0x5a, 0x12, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x6, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0xb, 0x12, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x", "axis"}, + Output: []string{"y"}, + Name: "", + OpType: "CumSum", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0001e6500)(name:"exclusive" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(5), + tensor.WithBacking([]float64{1, 2, 3, 4, 5}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{0}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(5), + tensor.WithBacking([]float64{0, 1, 3, 6, 10}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_cumsum_1d_exclusive_test.go b/backend/testbackend/onnx/onnx_test_cumsum_1d_exclusive_test.go new file mode 100644 index 00000000..bd1f0636 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_cumsum_1d_exclusive_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestCumsum1dExclusive(t *testing.T) { + mytest := NewTestCumsum1dExclusive() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_cumsum_1d_reverse.go b/backend/testbackend/onnx/onnx_test_cumsum_1d_reverse.go new file mode 100644 index 00000000..5d0c760d --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_cumsum_1d_reverse.go @@ -0,0 +1,174 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("CumSum", "TestCumsum1dReverse", NewTestCumsum1dReverse) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "axis"}, + Output: {"y"}, + Name: "", + OpType: "CumSum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "reverse", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_cumsum_1d_reverse", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "axis", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestCumsum1dReverse version: 5. +func NewTestCumsum1dReverse() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "CumSum", + Title: "TestCumsum1dReverse", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x74, 0xa, 0x24, 0xa, 0x1, 0x78, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x12, 0x1, 0x79, 0x22, 0x6, 0x43, 0x75, 0x6d, 0x53, 0x75, 0x6d, 0x2a, 0xe, 0xa, 0x7, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x16, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x75, 0x6d, 0x73, 0x75, 0x6d, 0x5f, 0x31, 0x64, 0x5f, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0xb, 0x12, 0x4, 0xa, 0x2, 0x8, 0x5, 0x5a, 0x12, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x6, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0xb, 0x12, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x", "axis"}, + Output: []string{"y"}, + Name: "", + OpType: "CumSum", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000216b00)(name:"reverse" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(5), + tensor.WithBacking([]float64{1, 2, 3, 4, 5}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{0}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(5), + tensor.WithBacking([]float64{15, 14, 12, 9, 5}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_cumsum_1d_reverse_exclusive.go b/backend/testbackend/onnx/onnx_test_cumsum_1d_reverse_exclusive.go new file mode 100644 index 00000000..6ca6c58a --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_cumsum_1d_reverse_exclusive.go @@ -0,0 +1,193 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("CumSum", "TestCumsum1dReverseExclusive", NewTestCumsum1dReverseExclusive) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "axis"}, + Output: {"y"}, + Name: "", + OpType: "CumSum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "exclusive", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "reverse", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_cumsum_1d_reverse_exclusive", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "axis", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestCumsum1dReverseExclusive version: 5. +func NewTestCumsum1dReverseExclusive() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "CumSum", + Title: "TestCumsum1dReverseExclusive", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x90, 0x1, 0xa, 0x36, 0xa, 0x1, 0x78, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x12, 0x1, 0x79, 0x22, 0x6, 0x43, 0x75, 0x6d, 0x53, 0x75, 0x6d, 0x2a, 0x10, 0xa, 0x9, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xe, 0xa, 0x7, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x75, 0x6d, 0x73, 0x75, 0x6d, 0x5f, 0x31, 0x64, 0x5f, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x5f, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x73, 0x69, 0x76, 0x65, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0xb, 0x12, 0x4, 0xa, 0x2, 0x8, 0x5, 0x5a, 0x12, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x6, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0xb, 0x12, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x", "axis"}, + Output: []string{"y"}, + Name: "", + OpType: "CumSum", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000216e00)(name:"exclusive" type:INT i:1 ), + (*ir.AttributeProto)(0xc000216f00)(name:"reverse" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(5), + tensor.WithBacking([]float64{1, 2, 3, 4, 5}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{0}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(5), + tensor.WithBacking([]float64{14, 12, 9, 5, 0}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_cumsum_1d_reverse_exclusive_test.go b/backend/testbackend/onnx/onnx_test_cumsum_1d_reverse_exclusive_test.go new file mode 100644 index 00000000..54a4b397 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_cumsum_1d_reverse_exclusive_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestCumsum1dReverseExclusive(t *testing.T) { + mytest := NewTestCumsum1dReverseExclusive() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_nobroadcast_test.go b/backend/testbackend/onnx/onnx_test_cumsum_1d_reverse_test.go similarity index 88% rename from backend/testbackend/onnx/onnx_test_gemm_nobroadcast_test.go rename to backend/testbackend/onnx/onnx_test_cumsum_1d_reverse_test.go index d6399e8e..26f7cd3d 100644 --- a/backend/testbackend/onnx/onnx_test_gemm_nobroadcast_test.go +++ b/backend/testbackend/onnx/onnx_test_cumsum_1d_reverse_test.go @@ -7,8 +7,8 @@ import ( "github.com/owulveryck/onnx-go/internal/onnx/ir" ) -func TestNewTestGemmNobroadcast(t *testing.T) { - mytest := NewTestGemmNobroadcast() +func TestNewTestCumsum1dReverse(t *testing.T) { + mytest := NewTestCumsum1dReverse() var model ir.ModelProto err := proto.Unmarshal(mytest.ModelB, &model) if err != nil { diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze_test.go b/backend/testbackend/onnx/onnx_test_cumsum_1d_test.go similarity index 89% rename from backend/testbackend/onnx/onnx_test_unsqueeze_test.go rename to backend/testbackend/onnx/onnx_test_cumsum_1d_test.go index 72b0f5ee..fd374299 100644 --- a/backend/testbackend/onnx/onnx_test_unsqueeze_test.go +++ b/backend/testbackend/onnx/onnx_test_cumsum_1d_test.go @@ -7,8 +7,8 @@ import ( "github.com/owulveryck/onnx-go/internal/onnx/ir" ) -func TestNewTestUnsqueeze(t *testing.T) { - mytest := NewTestUnsqueeze() +func TestNewTestCumsum1d(t *testing.T) { + mytest := NewTestCumsum1d() var model ir.ModelProto err := proto.Unmarshal(mytest.ModelB, &model) if err != nil { diff --git a/backend/testbackend/onnx/onnx_test_cumsum_2d_axis_0.go b/backend/testbackend/onnx/onnx_test_cumsum_2d_axis_0.go new file mode 100644 index 00000000..7d3c412e --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_cumsum_2d_axis_0.go @@ -0,0 +1,161 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("CumSum", "TestCumsum2dAxis0", NewTestCumsum2dAxis0) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "axis"}, + Output: {"y"}, + Name: "", + OpType: "CumSum", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_cumsum_2d_axis_0", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "axis", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestCumsum2dAxis0 version: 5. +func NewTestCumsum2dAxis0() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "CumSum", + Title: "TestCumsum2dAxis0", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x6b, 0xa, 0x14, 0xa, 0x1, 0x78, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x12, 0x1, 0x79, 0x22, 0x6, 0x43, 0x75, 0x6d, 0x53, 0x75, 0x6d, 0x12, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x75, 0x6d, 0x73, 0x75, 0x6d, 0x5f, 0x32, 0x64, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x30, 0x5a, 0x13, 0xa, 0x1, 0x78, 0x12, 0xe, 0xa, 0xc, 0x8, 0xb, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x12, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x6, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0xb, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x", "axis"}, + Output: []string{"y"}, + Name: "", + OpType: "CumSum", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3), + tensor.WithBacking([]float64{1, 2, 3, 4, 5, 6}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{0}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3), + tensor.WithBacking([]float64{1, 2, 3, 5, 7, 9}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_resize_nearest_test.go b/backend/testbackend/onnx/onnx_test_cumsum_2d_axis_0_test.go similarity index 88% rename from backend/testbackend/onnx/onnx_test_resize_nearest_test.go rename to backend/testbackend/onnx/onnx_test_cumsum_2d_axis_0_test.go index 8596344b..51ecc565 100644 --- a/backend/testbackend/onnx/onnx_test_resize_nearest_test.go +++ b/backend/testbackend/onnx/onnx_test_cumsum_2d_axis_0_test.go @@ -7,8 +7,8 @@ import ( "github.com/owulveryck/onnx-go/internal/onnx/ir" ) -func TestNewTestResizeNearest(t *testing.T) { - mytest := NewTestResizeNearest() +func TestNewTestCumsum2dAxis0(t *testing.T) { + mytest := NewTestCumsum2dAxis0() var model ir.ModelProto err := proto.Unmarshal(mytest.ModelB, &model) if err != nil { diff --git a/backend/testbackend/onnx/onnx_test_cumsum_2d_axis_1.go b/backend/testbackend/onnx/onnx_test_cumsum_2d_axis_1.go new file mode 100644 index 00000000..eab608c8 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_cumsum_2d_axis_1.go @@ -0,0 +1,161 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("CumSum", "TestCumsum2dAxis1", NewTestCumsum2dAxis1) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "axis"}, + Output: {"y"}, + Name: "", + OpType: "CumSum", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_cumsum_2d_axis_1", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "axis", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestCumsum2dAxis1 version: 5. +func NewTestCumsum2dAxis1() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "CumSum", + Title: "TestCumsum2dAxis1", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x6b, 0xa, 0x14, 0xa, 0x1, 0x78, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x12, 0x1, 0x79, 0x22, 0x6, 0x43, 0x75, 0x6d, 0x53, 0x75, 0x6d, 0x12, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x75, 0x6d, 0x73, 0x75, 0x6d, 0x5f, 0x32, 0x64, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x31, 0x5a, 0x13, 0xa, 0x1, 0x78, 0x12, 0xe, 0xa, 0xc, 0x8, 0xb, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x12, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x6, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0xb, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x", "axis"}, + Output: []string{"y"}, + Name: "", + OpType: "CumSum", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3), + tensor.WithBacking([]float64{1, 2, 3, 4, 5, 6}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{1}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3), + tensor.WithBacking([]float64{1, 3, 6, 4, 9, 15}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_broadcast_test.go b/backend/testbackend/onnx/onnx_test_cumsum_2d_axis_1_test.go similarity index 88% rename from backend/testbackend/onnx/onnx_test_gemm_broadcast_test.go rename to backend/testbackend/onnx/onnx_test_cumsum_2d_axis_1_test.go index aeb81731..66923f25 100644 --- a/backend/testbackend/onnx/onnx_test_gemm_broadcast_test.go +++ b/backend/testbackend/onnx/onnx_test_cumsum_2d_axis_1_test.go @@ -7,8 +7,8 @@ import ( "github.com/owulveryck/onnx-go/internal/onnx/ir" ) -func TestNewTestGemmBroadcast(t *testing.T) { - mytest := NewTestGemmBroadcast() +func TestNewTestCumsum2dAxis1(t *testing.T) { + mytest := NewTestCumsum2dAxis1() var model ir.ModelProto err := proto.Unmarshal(mytest.ModelB, &model) if err != nil { diff --git a/backend/testbackend/onnx/onnx_test_cumsum_2d_negative_axis.go b/backend/testbackend/onnx/onnx_test_cumsum_2d_negative_axis.go new file mode 100644 index 00000000..669602a8 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_cumsum_2d_negative_axis.go @@ -0,0 +1,161 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("CumSum", "TestCumsum2dNegativeAxis", NewTestCumsum2dNegativeAxis) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "axis"}, + Output: {"y"}, + Name: "", + OpType: "CumSum", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_cumsum_2d_negative_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "axis", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestCumsum2dNegativeAxis version: 6. +func NewTestCumsum2dNegativeAxis() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "CumSum", + Title: "TestCumsum2dNegativeAxis", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x72, 0xa, 0x14, 0xa, 0x1, 0x78, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x12, 0x1, 0x79, 0x22, 0x6, 0x43, 0x75, 0x6d, 0x53, 0x75, 0x6d, 0x12, 0x1c, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x63, 0x75, 0x6d, 0x73, 0x75, 0x6d, 0x5f, 0x32, 0x64, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x13, 0xa, 0x1, 0x78, 0x12, 0xe, 0xa, 0xc, 0x8, 0xb, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x12, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x6, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0xb, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x", "axis"}, + Output: []string{"y"}, + Name: "", + OpType: "CumSum", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3), + tensor.WithBacking([]float64{1, 2, 3, 4, 5, 6}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{-1}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3), + tensor.WithBacking([]float64{1, 3, 6, 4, 9, 15}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_cumsum_2d_negative_axis_test.go b/backend/testbackend/onnx/onnx_test_cumsum_2d_negative_axis_test.go new file mode 100644 index 00000000..0e695f12 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_cumsum_2d_negative_axis_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestCumsum2dNegativeAxis(t *testing.T) { + mytest := NewTestCumsum2dNegativeAxis() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_depthtospace.go b/backend/testbackend/onnx/onnx_test_depthtospace.go deleted file mode 100644 index 0ac5cc6b..00000000 --- a/backend/testbackend/onnx/onnx_test_depthtospace.go +++ /dev/null @@ -1,52 +0,0 @@ -package onnxtest - -// this file is auto-generated... DO NOT EDIT - -import ( - "github.com/owulveryck/onnx-go/backend/testbackend" - "gorgonia.org/tensor" -) - -func init() { - testbackend.Register("DepthToSpace", "TestDepthtospace", NewTestDepthtospace) -} - -// NewTestDepthtospace version: 3. -func NewTestDepthtospace() *testbackend.TestCase { - return &testbackend.TestCase{ - OpType: "DepthToSpace", - Title: "TestDepthtospace", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x75, 0xa, 0x26, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0xc, 0x44, 0x65, 0x70, 0x74, 0x68, 0x54, 0x6f, 0x53, 0x70, 0x61, 0x63, 0x65, 0x2a, 0x10, 0xa, 0x9, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x2, 0xa0, 0x1, 0x2, 0x12, 0x11, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x65, 0x70, 0x74, 0x68, 0x74, 0x6f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5a, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x6, 0x42, 0x2, 0x10, 0x9}, - - /* - - &ir.NodeProto{ - Input: []string{"x"}, - Output: []string{"y"}, - Name: "", - OpType: "DepthToSpace", - Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000118c00)(name:"blocksize" type:INT i:2 ) - } - , - }, - - - */ - - Input: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(2, 8, 3, 3), - tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256, 0.15896958, 0.11037514, 0.6563296, 0.13818295, 0.19658236, 0.36872518, 0.82099324, 0.09710128, 0.8379449, 0.09609841, 0.97645944, 0.4686512, 0.9767611, 0.6048455, 0.7392636, 0.039187793, 0.28280696, 0.12019656, 0.2961402, 0.11872772, 0.31798318, 0.41426298, 0.064147495, 0.6924721, 0.56660146, 0.2653895, 0.5232481, 0.09394051, 0.5759465, 0.9292962, 0.31856894, 0.6674104, 0.13179787, 0.7163272, 0.2894061, 0.18319136, 0.5865129, 0.020107547, 0.82894003, 0.004695476, 0.6778165, 0.27000797, 0.735194, 0.96218854, 0.24875315, 0.57615733, 0.5920419, 0.5722519, 0.22308163, 0.952749, 0.44712538, 0.84640867, 0.6994793, 0.29743695, 0.81379783, 0.39650574, 0.8811032, 0.5812729, 0.8817354, 0.6925316, 0.7252543, 0.50132436, 0.95608366, 0.6439902, 0.42385504, 0.6063932, 0.019193199, 0.30157483, 0.66017354, 0.2900776, 0.6180154, 0.4287687, 0.13547407, 0.29828233, 0.5699649, 0.59087276, 0.57432526, 0.6532008, 0.65210325, 0.43141845, 0.8965466, 0.36756188, 0.43586493, 0.89192337}), - ), - }, - ExpectedOutput: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(2, 2, 6, 6), - tensor.WithBacking([]float32{0.5488135, 0.77815676, 0.71518934, 0.87001216, 0.60276335, 0.9786183, 0.6120957, 0.20887676, 0.616934, 0.16130951, 0.94374806, 0.6531083, 0.5448832, 0.7991586, 0.4236548, 0.46147937, 0.6458941, 0.7805292, 0.6818203, 0.2532916, 0.3595079, 0.46631077, 0.43703195, 0.2444256, 0.4375872, 0.11827443, 0.891773, 0.639921, 0.96366274, 0.14335328, 0.6976312, 0.15896958, 0.06022547, 0.11037514, 0.6667667, 0.6563296, 0.3834415, 0.9446689, 0.79172504, 0.5218483, 0.5288949, 0.41466194, 0.67063785, 0.13818295, 0.21038257, 0.19658236, 0.12892629, 0.36872518, 0.56804454, 0.2645556, 0.92559665, 0.7742337, 0.071036056, 0.45615032, 0.31542835, 0.82099324, 0.36371076, 0.09710128, 0.57019675, 0.8379449, 0.0871293, 0.56843394, 0.020218397, 0.0187898, 0.83261985, 0.6176355, 0.43860152, 0.09609841, 0.9883738, 0.97645944, 0.10204481, 0.4686512, 0.9767611, 0.31856894, 0.6048455, 0.6674104, 0.7392636, 0.13179787, 0.22308163, 0.019193199, 0.952749, 0.30157483, 0.44712538, 0.66017354, 0.039187793, 0.7163272, 0.28280696, 0.2894061, 0.12019656, 0.18319136, 0.84640867, 0.2900776, 0.6994793, 0.6180154, 0.29743695, 0.4287687, 0.2961402, 0.5865129, 0.11872772, 0.020107547, 0.31798318, 0.82894003, 0.81379783, 0.13547407, 0.39650574, 0.29828233, 0.8811032, 0.5699649, 0.41426298, 0.004695476, 0.064147495, 0.6778165, 0.6924721, 0.27000797, 0.5812729, 0.59087276, 0.8817354, 0.57432526, 0.6925316, 0.6532008, 0.56660146, 0.735194, 0.2653895, 0.96218854, 0.5232481, 0.24875315, 0.7252543, 0.65210325, 0.50132436, 0.43141845, 0.95608366, 0.8965466, 0.09394051, 0.57615733, 0.5759465, 0.5920419, 0.9292962, 0.5722519, 0.6439902, 0.36756188, 0.42385504, 0.43586493, 0.6063932, 0.89192337}), - ), - }, - } -} diff --git a/backend/testbackend/onnx/onnx_test_depthtospace_crd_mode.go b/backend/testbackend/onnx/onnx_test_depthtospace_crd_mode.go new file mode 100644 index 00000000..8f0544ca --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_depthtospace_crd_mode.go @@ -0,0 +1,192 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("DepthToSpace", "TestDepthtospaceCrdMode", NewTestDepthtospaceCrdMode) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "DepthToSpace", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "blocksize", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "mode", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x43, 0x52, 0x44}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_depthtospace_crd_mode", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:8}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestDepthtospaceCrdMode version: 5. +func NewTestDepthtospaceCrdMode() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "DepthToSpace", + Title: "TestDepthtospaceCrdMode", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x8e, 0x1, 0xa, 0x36, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0xc, 0x44, 0x65, 0x70, 0x74, 0x68, 0x54, 0x6f, 0x53, 0x70, 0x61, 0x63, 0x65, 0x2a, 0x10, 0xa, 0x9, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x2, 0xa0, 0x1, 0x2, 0x2a, 0xe, 0xa, 0x4, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x3, 0x43, 0x52, 0x44, 0xa0, 0x1, 0x3, 0x12, 0x1a, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x65, 0x70, 0x74, 0x68, 0x74, 0x6f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x63, 0x72, 0x64, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x5a, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x6, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "DepthToSpace", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000217900)(name:"blocksize" type:INT i:2 ), + (*ir.AttributeProto)(0xc000217a00)(name:"mode" type:STRING s:"CRD" ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 8, 3, 3), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256, 0.15896958, 0.11037514, 0.6563296, 0.13818295, 0.19658236, 0.36872518, 0.82099324, 0.09710128, 0.8379449, 0.09609841, 0.97645944, 0.4686512, 0.9767611, 0.6048455, 0.7392636, 0.039187793, 0.28280696, 0.12019656, 0.2961402, 0.11872772, 0.31798318, 0.41426298, 0.064147495, 0.6924721, 0.56660146, 0.2653895, 0.5232481, 0.09394051, 0.5759465, 0.9292962, 0.31856894, 0.6674104, 0.13179787, 0.7163272, 0.2894061, 0.18319136, 0.5865129, 0.020107547, 0.82894003, 0.004695476, 0.6778165, 0.27000797, 0.735194, 0.96218854, 0.24875315, 0.57615733, 0.5920419, 0.5722519, 0.22308163, 0.952749, 0.44712538, 0.84640867, 0.6994793, 0.29743695, 0.81379783, 0.39650574, 0.8811032, 0.5812729, 0.8817354, 0.6925316, 0.7252543, 0.50132436, 0.95608366, 0.6439902, 0.42385504, 0.6063932, 0.019193199, 0.30157483, 0.66017354, 0.2900776, 0.6180154, 0.4287687, 0.13547407, 0.29828233, 0.5699649, 0.59087276, 0.57432526, 0.6532008, 0.65210325, 0.43141845, 0.8965466, 0.36756188, 0.43586493, 0.89192337}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2, 6, 6), + tensor.WithBacking([]float32{0.5488135, 0.3834415, 0.71518934, 0.79172504, 0.60276335, 0.5288949, 0.77815676, 0.9446689, 0.87001216, 0.5218483, 0.9786183, 0.41466194, 0.5448832, 0.56804454, 0.4236548, 0.92559665, 0.6458941, 0.071036056, 0.7991586, 0.2645556, 0.46147937, 0.7742337, 0.7805292, 0.45615032, 0.4375872, 0.0871293, 0.891773, 0.020218397, 0.96366274, 0.83261985, 0.11827443, 0.56843394, 0.639921, 0.0187898, 0.14335328, 0.6176355, 0.6120957, 0.67063785, 0.616934, 0.21038257, 0.94374806, 0.12892629, 0.20887676, 0.13818295, 0.16130951, 0.19658236, 0.6531083, 0.36872518, 0.6818203, 0.31542835, 0.3595079, 0.36371076, 0.43703195, 0.57019675, 0.2532916, 0.82099324, 0.46631077, 0.09710128, 0.2444256, 0.8379449, 0.6976312, 0.43860152, 0.06022547, 0.9883738, 0.6667667, 0.10204481, 0.15896958, 0.09609841, 0.11037514, 0.97645944, 0.6563296, 0.4686512, 0.9767611, 0.41426298, 0.6048455, 0.064147495, 0.7392636, 0.6924721, 0.31856894, 0.004695476, 0.6674104, 0.6778165, 0.13179787, 0.27000797, 0.039187793, 0.56660146, 0.28280696, 0.2653895, 0.12019656, 0.5232481, 0.7163272, 0.735194, 0.2894061, 0.96218854, 0.18319136, 0.24875315, 0.2961402, 0.09394051, 0.11872772, 0.5759465, 0.31798318, 0.9292962, 0.5865129, 0.57615733, 0.020107547, 0.5920419, 0.82894003, 0.5722519, 0.22308163, 0.5812729, 0.952749, 0.8817354, 0.44712538, 0.6925316, 0.019193199, 0.59087276, 0.30157483, 0.57432526, 0.66017354, 0.6532008, 0.84640867, 0.7252543, 0.6994793, 0.50132436, 0.29743695, 0.95608366, 0.2900776, 0.65210325, 0.6180154, 0.43141845, 0.4287687, 0.8965466, 0.81379783, 0.6439902, 0.39650574, 0.42385504, 0.8811032, 0.6063932, 0.13547407, 0.36756188, 0.29828233, 0.43586493, 0.5699649, 0.89192337}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_depthtospace_crd_mode_example.go b/backend/testbackend/onnx/onnx_test_depthtospace_crd_mode_example.go new file mode 100644 index 00000000..2df4ca16 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_depthtospace_crd_mode_example.go @@ -0,0 +1,192 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("DepthToSpace", "TestDepthtospaceCrdModeExample", NewTestDepthtospaceCrdModeExample) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "DepthToSpace", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "blocksize", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "mode", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x43, 0x52, 0x44}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_depthtospace_crd_mode_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:8}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestDepthtospaceCrdModeExample version: 5. +func NewTestDepthtospaceCrdModeExample() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "DepthToSpace", + Title: "TestDepthtospaceCrdModeExample", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x96, 0x1, 0xa, 0x36, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0xc, 0x44, 0x65, 0x70, 0x74, 0x68, 0x54, 0x6f, 0x53, 0x70, 0x61, 0x63, 0x65, 0x2a, 0x10, 0xa, 0x9, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x2, 0xa0, 0x1, 0x2, 0x2a, 0xe, 0xa, 0x4, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x3, 0x43, 0x52, 0x44, 0xa0, 0x1, 0x3, 0x12, 0x22, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x65, 0x70, 0x74, 0x68, 0x74, 0x6f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x63, 0x72, 0x64, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5a, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x6, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "DepthToSpace", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc0001e6100)(name:"blocksize" type:INT i:2 ), + (*ir.AttributeProto)(0xc0001e6400)(name:"mode" type:STRING s:"CRD" ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 8, 2, 3), + tensor.WithBacking([]float32{0, 1, 2, 3, 4, 5, 9, 10, 11, 12, 13, 14, 18, 19, 20, 21, 22, 23, 27, 28, 29, 30, 31, 32, 36, 37, 38, 39, 40, 41, 45, 46, 47, 48, 49, 50, 54, 55, 56, 57, 58, 59, 63, 64, 65, 66, 67, 68}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 2, 4, 6), + tensor.WithBacking([]float32{0, 9, 1, 10, 2, 11, 18, 27, 19, 28, 20, 29, 3, 12, 4, 13, 5, 14, 21, 30, 22, 31, 23, 32, 36, 45, 37, 46, 38, 47, 54, 63, 55, 64, 56, 65, 39, 48, 40, 49, 41, 50, 57, 66, 58, 67, 59, 68}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_depthtospace_crd_mode_example_test.go b/backend/testbackend/onnx/onnx_test_depthtospace_crd_mode_example_test.go new file mode 100644 index 00000000..73bb8950 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_depthtospace_crd_mode_example_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestDepthtospaceCrdModeExample(t *testing.T) { + mytest := NewTestDepthtospaceCrdModeExample() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_depthtospace_crd_mode_test.go b/backend/testbackend/onnx/onnx_test_depthtospace_crd_mode_test.go new file mode 100644 index 00000000..bf4c9e5e --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_depthtospace_crd_mode_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestDepthtospaceCrdMode(t *testing.T) { + mytest := NewTestDepthtospaceCrdMode() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_depthtospace_dcr_mode.go b/backend/testbackend/onnx/onnx_test_depthtospace_dcr_mode.go new file mode 100644 index 00000000..863e4474 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_depthtospace_dcr_mode.go @@ -0,0 +1,192 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("DepthToSpace", "TestDepthtospaceDcrMode", NewTestDepthtospaceDcrMode) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "DepthToSpace", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "blocksize", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "mode", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x44, 0x43, 0x52}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_depthtospace_dcr_mode", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:8}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestDepthtospaceDcrMode version: 5. +func NewTestDepthtospaceDcrMode() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "DepthToSpace", + Title: "TestDepthtospaceDcrMode", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x8e, 0x1, 0xa, 0x36, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0xc, 0x44, 0x65, 0x70, 0x74, 0x68, 0x54, 0x6f, 0x53, 0x70, 0x61, 0x63, 0x65, 0x2a, 0x10, 0xa, 0x9, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x2, 0xa0, 0x1, 0x2, 0x2a, 0xe, 0xa, 0x4, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x3, 0x44, 0x43, 0x52, 0xa0, 0x1, 0x3, 0x12, 0x1a, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x65, 0x70, 0x74, 0x68, 0x74, 0x6f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x64, 0x63, 0x72, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x5a, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x6, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "DepthToSpace", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000216c00)(name:"blocksize" type:INT i:2 ), + (*ir.AttributeProto)(0xc000216d00)(name:"mode" type:STRING s:"DCR" ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 8, 3, 3), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256, 0.15896958, 0.11037514, 0.6563296, 0.13818295, 0.19658236, 0.36872518, 0.82099324, 0.09710128, 0.8379449, 0.09609841, 0.97645944, 0.4686512, 0.9767611, 0.6048455, 0.7392636, 0.039187793, 0.28280696, 0.12019656, 0.2961402, 0.11872772, 0.31798318, 0.41426298, 0.064147495, 0.6924721, 0.56660146, 0.2653895, 0.5232481, 0.09394051, 0.5759465, 0.9292962, 0.31856894, 0.6674104, 0.13179787, 0.7163272, 0.2894061, 0.18319136, 0.5865129, 0.020107547, 0.82894003, 0.004695476, 0.6778165, 0.27000797, 0.735194, 0.96218854, 0.24875315, 0.57615733, 0.5920419, 0.5722519, 0.22308163, 0.952749, 0.44712538, 0.84640867, 0.6994793, 0.29743695, 0.81379783, 0.39650574, 0.8811032, 0.5812729, 0.8817354, 0.6925316, 0.7252543, 0.50132436, 0.95608366, 0.6439902, 0.42385504, 0.6063932, 0.019193199, 0.30157483, 0.66017354, 0.2900776, 0.6180154, 0.4287687, 0.13547407, 0.29828233, 0.5699649, 0.59087276, 0.57432526, 0.6532008, 0.65210325, 0.43141845, 0.8965466, 0.36756188, 0.43586493, 0.89192337}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2, 6, 6), + tensor.WithBacking([]float32{0.5488135, 0.77815676, 0.71518934, 0.87001216, 0.60276335, 0.9786183, 0.6120957, 0.20887676, 0.616934, 0.16130951, 0.94374806, 0.6531083, 0.5448832, 0.7991586, 0.4236548, 0.46147937, 0.6458941, 0.7805292, 0.6818203, 0.2532916, 0.3595079, 0.46631077, 0.43703195, 0.2444256, 0.4375872, 0.11827443, 0.891773, 0.639921, 0.96366274, 0.14335328, 0.6976312, 0.15896958, 0.06022547, 0.11037514, 0.6667667, 0.6563296, 0.3834415, 0.9446689, 0.79172504, 0.5218483, 0.5288949, 0.41466194, 0.67063785, 0.13818295, 0.21038257, 0.19658236, 0.12892629, 0.36872518, 0.56804454, 0.2645556, 0.92559665, 0.7742337, 0.071036056, 0.45615032, 0.31542835, 0.82099324, 0.36371076, 0.09710128, 0.57019675, 0.8379449, 0.0871293, 0.56843394, 0.020218397, 0.0187898, 0.83261985, 0.6176355, 0.43860152, 0.09609841, 0.9883738, 0.97645944, 0.10204481, 0.4686512, 0.9767611, 0.31856894, 0.6048455, 0.6674104, 0.7392636, 0.13179787, 0.22308163, 0.019193199, 0.952749, 0.30157483, 0.44712538, 0.66017354, 0.039187793, 0.7163272, 0.28280696, 0.2894061, 0.12019656, 0.18319136, 0.84640867, 0.2900776, 0.6994793, 0.6180154, 0.29743695, 0.4287687, 0.2961402, 0.5865129, 0.11872772, 0.020107547, 0.31798318, 0.82894003, 0.81379783, 0.13547407, 0.39650574, 0.29828233, 0.8811032, 0.5699649, 0.41426298, 0.004695476, 0.064147495, 0.6778165, 0.6924721, 0.27000797, 0.5812729, 0.59087276, 0.8817354, 0.57432526, 0.6925316, 0.6532008, 0.56660146, 0.735194, 0.2653895, 0.96218854, 0.5232481, 0.24875315, 0.7252543, 0.65210325, 0.50132436, 0.43141845, 0.95608366, 0.8965466, 0.09394051, 0.57615733, 0.5759465, 0.5920419, 0.9292962, 0.5722519, 0.6439902, 0.36756188, 0.42385504, 0.43586493, 0.6063932, 0.89192337}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_depthtospace_dcr_mode_test.go b/backend/testbackend/onnx/onnx_test_depthtospace_dcr_mode_test.go new file mode 100644 index 00000000..faaf0248 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_depthtospace_dcr_mode_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestDepthtospaceDcrMode(t *testing.T) { + mytest := NewTestDepthtospaceDcrMode() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_depthtospace_example.go b/backend/testbackend/onnx/onnx_test_depthtospace_example.go index e084d096..072c4fc7 100644 --- a/backend/testbackend/onnx/onnx_test_depthtospace_example.go +++ b/backend/testbackend/onnx/onnx_test_depthtospace_example.go @@ -11,12 +11,151 @@ func init() { testbackend.Register("DepthToSpace", "TestDepthtospaceExample", NewTestDepthtospaceExample) } -// NewTestDepthtospaceExample version: 3. +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "DepthToSpace", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "blocksize", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "mode", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x44, 0x43, 0x52}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_depthtospace_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:8}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestDepthtospaceExample version: 5. func NewTestDepthtospaceExample() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "DepthToSpace", Title: "TestDepthtospaceExample", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x7d, 0xa, 0x26, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0xc, 0x44, 0x65, 0x70, 0x74, 0x68, 0x54, 0x6f, 0x53, 0x70, 0x61, 0x63, 0x65, 0x2a, 0x10, 0xa, 0x9, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x2, 0xa0, 0x1, 0x2, 0x12, 0x19, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x65, 0x70, 0x74, 0x68, 0x74, 0x6f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5a, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x6, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x8d, 0x1, 0xa, 0x36, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0xc, 0x44, 0x65, 0x70, 0x74, 0x68, 0x54, 0x6f, 0x53, 0x70, 0x61, 0x63, 0x65, 0x2a, 0x10, 0xa, 0x9, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x2, 0xa0, 0x1, 0x2, 0x2a, 0xe, 0xa, 0x4, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x3, 0x44, 0x43, 0x52, 0xa0, 0x1, 0x3, 0x12, 0x19, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x65, 0x70, 0x74, 0x68, 0x74, 0x6f, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5a, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x6, 0x42, 0x2, 0x10, 0xb}, /* @@ -25,8 +164,9 @@ func NewTestDepthtospaceExample() *testbackend.TestCase { Output: []string{"y"}, Name: "", OpType: "DepthToSpace", - Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000118e00)(name:"blocksize" type:INT i:2 ) + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000217200)(name:"blocksize" type:INT i:2 ), + (*ir.AttributeProto)(0xc000217300)(name:"mode" type:STRING s:"DCR" ) } , }, @@ -37,15 +177,15 @@ func NewTestDepthtospaceExample() *testbackend.TestCase { Input: []tensor.Tensor{ tensor.New( - tensor.WithShape(1, 4, 2, 3), - tensor.WithBacking([]float32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23}), + tensor.WithShape(1, 8, 2, 3), + tensor.WithBacking([]float32{0, 1, 2, 3, 4, 5, 9, 10, 11, 12, 13, 14, 18, 19, 20, 21, 22, 23, 27, 28, 29, 30, 31, 32, 36, 37, 38, 39, 40, 41, 45, 46, 47, 48, 49, 50, 54, 55, 56, 57, 58, 59, 63, 64, 65, 66, 67, 68}), ), }, ExpectedOutput: []tensor.Tensor{ tensor.New( - tensor.WithShape(1, 1, 4, 6), - tensor.WithBacking([]float32{0, 6, 1, 7, 2, 8, 12, 18, 13, 19, 14, 20, 3, 9, 4, 10, 5, 11, 15, 21, 16, 22, 17, 23}), + tensor.WithShape(1, 2, 4, 6), + tensor.WithBacking([]float32{0, 18, 1, 19, 2, 20, 36, 54, 37, 55, 38, 56, 3, 21, 4, 22, 5, 23, 39, 57, 40, 58, 41, 59, 9, 27, 10, 28, 11, 29, 45, 63, 46, 64, 47, 65, 12, 30, 13, 31, 14, 32, 48, 66, 49, 67, 50, 68}), ), }, } diff --git a/backend/testbackend/onnx/onnx_test_det_2d.go b/backend/testbackend/onnx/onnx_test_det_2d.go new file mode 100644 index 00000000..a12be949 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_det_2d.go @@ -0,0 +1,125 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Det", "TestDet2d", NewTestDet2d) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Det", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_det_2d", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestDet2d version: 6. +func NewTestDet2d() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Det", + Title: "TestDet2d", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x3c, 0xa, 0xb, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x3, 0x44, 0x65, 0x74, 0x12, 0xb, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x65, 0x74, 0x5f, 0x32, 0x64, 0x5a, 0x13, 0xa, 0x1, 0x78, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0xb, 0xa, 0x1, 0x79, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Det", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{0, 1, 2, 3}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{-2}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_depthtospace_test.go b/backend/testbackend/onnx/onnx_test_det_2d_test.go similarity index 89% rename from backend/testbackend/onnx/onnx_test_depthtospace_test.go rename to backend/testbackend/onnx/onnx_test_det_2d_test.go index dd11c467..82806583 100644 --- a/backend/testbackend/onnx/onnx_test_depthtospace_test.go +++ b/backend/testbackend/onnx/onnx_test_det_2d_test.go @@ -7,8 +7,8 @@ import ( "github.com/owulveryck/onnx-go/internal/onnx/ir" ) -func TestNewTestDepthtospace(t *testing.T) { - mytest := NewTestDepthtospace() +func TestNewTestDet2d(t *testing.T) { + mytest := NewTestDet2d() var model ir.ModelProto err := proto.Unmarshal(mytest.ModelB, &model) if err != nil { diff --git a/backend/testbackend/onnx/onnx_test_det_nd.go b/backend/testbackend/onnx/onnx_test_det_nd.go new file mode 100644 index 00000000..871e5d50 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_det_nd.go @@ -0,0 +1,136 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Det", "TestDetNd", NewTestDetNd) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Det", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_det_nd", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestDetNd version: 6. +func NewTestDetNd() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Det", + Title: "TestDetNd", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x44, 0xa, 0xb, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x3, 0x44, 0x65, 0x74, 0x12, 0xb, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x65, 0x74, 0x5f, 0x6e, 0x64, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Det", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{1, 2, 3, 4, 1, 2, 2, 1, 1, 3, 3, 1}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]float32{-2, -3, -8}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_det_nd_test.go b/backend/testbackend/onnx/onnx_test_det_nd_test.go new file mode 100644 index 00000000..2aba0b5d --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_det_nd_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestDetNd(t *testing.T) { + mytest := NewTestDetNd() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_div.go b/backend/testbackend/onnx/onnx_test_div.go index 2b374550..4ccbb081 100644 --- a/backend/testbackend/onnx/onnx_test_div.go +++ b/backend/testbackend/onnx/onnx_test_div.go @@ -11,6 +11,128 @@ func init() { testbackend.Register("Div", "TestDiv", NewTestDiv) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Div", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_div", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestDiv version: 3. func NewTestDiv() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_div_bcast.go b/backend/testbackend/onnx/onnx_test_div_bcast.go index 24bd643e..2206bc4b 100644 --- a/backend/testbackend/onnx/onnx_test_div_bcast.go +++ b/backend/testbackend/onnx/onnx_test_div_bcast.go @@ -11,6 +11,120 @@ func init() { testbackend.Register("Div", "TestDivBcast", NewTestDivBcast) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Div", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_div_bcast", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestDivBcast version: 3. func NewTestDivBcast() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_div_example.go b/backend/testbackend/onnx/onnx_test_div_example.go index 7254cb33..e1c90a68 100644 --- a/backend/testbackend/onnx/onnx_test_div_example.go +++ b/backend/testbackend/onnx/onnx_test_div_example.go @@ -11,6 +11,104 @@ func init() { testbackend.Register("Div", "TestDivExample", NewTestDivExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Div", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_div_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestDivExample version: 3. func NewTestDivExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_dropout_default.go b/backend/testbackend/onnx/onnx_test_dropout_default.go index 8125160d..20bf7519 100644 --- a/backend/testbackend/onnx/onnx_test_dropout_default.go +++ b/backend/testbackend/onnx/onnx_test_dropout_default.go @@ -11,12 +11,90 @@ func init() { testbackend.Register("Dropout", "TestDropoutDefault", NewTestDropoutDefault) } -// NewTestDropoutDefault version: 3. +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Dropout", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_dropout_default", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestDropoutDefault version: 6. func NewTestDropoutDefault() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "Dropout", Title: "TestDropoutDefault", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x49, 0xa, 0xf, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x7, 0x44, 0x72, 0x6f, 0x70, 0x6f, 0x75, 0x74, 0x12, 0x14, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x72, 0x6f, 0x70, 0x6f, 0x75, 0x74, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x49, 0xa, 0xf, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x7, 0x44, 0x72, 0x6f, 0x70, 0x6f, 0x75, 0x74, 0x12, 0x14, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x72, 0x6f, 0x70, 0x6f, 0x75, 0x74, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xc}, /* diff --git a/backend/testbackend/onnx/onnx_test_dropout_default_old.go b/backend/testbackend/onnx/onnx_test_dropout_default_old.go new file mode 100644 index 00000000..c5172c18 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_dropout_default_old.go @@ -0,0 +1,128 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Dropout", "TestDropoutDefaultOld", NewTestDropoutDefaultOld) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Dropout", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_dropout_default_old", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestDropoutDefaultOld version: 6. +func NewTestDropoutDefaultOld() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Dropout", + Title: "TestDropoutDefaultOld", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x4d, 0xa, 0xf, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x7, 0x44, 0x72, 0x6f, 0x70, 0x6f, 0x75, 0x74, 0x12, 0x18, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x72, 0x6f, 0x70, 0x6f, 0x75, 0x74, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x6f, 0x6c, 0x64, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x4, 0xa, 0x0, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Dropout", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]float32{-1, 0, 1}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]float32{-1, 0, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_dropout_default_old_test.go b/backend/testbackend/onnx/onnx_test_dropout_default_old_test.go new file mode 100644 index 00000000..6175b188 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_dropout_default_old_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestDropoutDefaultOld(t *testing.T) { + mytest := NewTestDropoutDefaultOld() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_dropout_random.go b/backend/testbackend/onnx/onnx_test_dropout_random.go index dea918e9..e84bab54 100644 --- a/backend/testbackend/onnx/onnx_test_dropout_random.go +++ b/backend/testbackend/onnx/onnx_test_dropout_random.go @@ -11,22 +11,148 @@ func init() { testbackend.Register("Dropout", "TestDropoutRandom", NewTestDropoutRandom) } -// NewTestDropoutRandom version: 3. +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "ratio"}, + Output: {"y"}, + Name: "", + OpType: "Dropout", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "seed", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_dropout_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "ratio", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestDropoutRandom version: 6. func NewTestDropoutRandom() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "Dropout", Title: "TestDropoutRandom", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x69, 0xa, 0x20, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x7, 0x44, 0x72, 0x6f, 0x70, 0x6f, 0x75, 0x74, 0x2a, 0xf, 0xa, 0x5, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x15, 0xcd, 0xcc, 0x4c, 0x3e, 0xa0, 0x1, 0x1, 0x12, 0x13, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x72, 0x6f, 0x70, 0x6f, 0x75, 0x74, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x7d, 0xa, 0x23, 0xa, 0x1, 0x78, 0xa, 0x5, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x12, 0x1, 0x79, 0x22, 0x7, 0x44, 0x72, 0x6f, 0x70, 0x6f, 0x75, 0x74, 0x2a, 0xb, 0xa, 0x4, 0x73, 0x65, 0x65, 0x64, 0x18, 0x0, 0xa0, 0x1, 0x2, 0x12, 0x13, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x72, 0x6f, 0x70, 0x6f, 0x75, 0x74, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x5a, 0xf, 0xa, 0x5, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x12, 0x6, 0xa, 0x4, 0x8, 0xb, 0x12, 0x0, 0x62, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xc}, /* &ir.NodeProto{ - Input: []string{"x"}, + Input: []string{"x", "ratio"}, Output: []string{"y"}, Name: "", OpType: "Dropout", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000119a00)(name:"ratio" type:FLOAT f:0.2 ) + (*ir.AttributeProto)(0xc000217300)(name:"seed" type:INT ) } , }, @@ -40,12 +166,17 @@ func NewTestDropoutRandom() *testbackend.TestCase { tensor.WithShape(3, 4, 5), tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{0.7543842447740937}), + ), }, ExpectedOutput: []tensor.Tensor{ tensor.New( tensor.WithShape(3, 4, 5), - tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + tensor.WithBacking([]float32{1.7640524, 0, 0, 2.2408931, 0, 0, 0.95008844, 0, 0, 0.41059852, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.85409576, 0, 0.6536186, 0, -0.742165, 2.2697546, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.2302907, 0, 0, -0.30230275, 0, 0, 0, 0, -0.5096522, 0, -1.2527953, 0.7774904, 0, 0, 0, 0, 0, -1.1806322, 0, 0.42833188, 0, 0, 0, 0}), ), }, } diff --git a/backend/testbackend/onnx/onnx_test_dropout_random_old.go b/backend/testbackend/onnx/onnx_test_dropout_random_old.go new file mode 100644 index 00000000..4fed7e26 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_dropout_random_old.go @@ -0,0 +1,165 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Dropout", "TestDropoutRandomOld", NewTestDropoutRandomOld) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Dropout", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "ratio", + RefAttrName: "", + DocString: "", + Type: 1, + F: 0.20000000298023224, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_dropout_random_old", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestDropoutRandomOld version: 6. +func NewTestDropoutRandomOld() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Dropout", + Title: "TestDropoutRandomOld", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x6d, 0xa, 0x20, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x7, 0x44, 0x72, 0x6f, 0x70, 0x6f, 0x75, 0x74, 0x2a, 0xf, 0xa, 0x5, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x15, 0xcd, 0xcc, 0x4c, 0x3e, 0xa0, 0x1, 0x1, 0x12, 0x17, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x64, 0x72, 0x6f, 0x70, 0x6f, 0x75, 0x74, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5f, 0x6f, 0x6c, 0x64, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x4, 0xa, 0x0, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Dropout", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217800)(name:"ratio" type:FLOAT f:0.2 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_dropout_random_old_test.go b/backend/testbackend/onnx/onnx_test_dropout_random_old_test.go new file mode 100644 index 00000000..8c4ccd63 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_dropout_random_old_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestDropoutRandomOld(t *testing.T) { + mytest := NewTestDropoutRandomOld() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_edge_pad.go b/backend/testbackend/onnx/onnx_test_edge_pad.go index a606ec54..8b5a337c 100644 --- a/backend/testbackend/onnx/onnx_test_edge_pad.go +++ b/backend/testbackend/onnx/onnx_test_edge_pad.go @@ -11,23 +11,163 @@ func init() { testbackend.Register("Pad", "TestEdgePad", NewTestEdgePad) } -// NewTestEdgePad version: 3. +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "pads"}, + Output: {"y"}, + Name: "", + OpType: "Pad", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "mode", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x65, 0x64, 0x67, 0x65}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_edge_pad", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "pads", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:8}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestEdgePad version: 6. func NewTestEdgePad() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "Pad", Title: "TestEdgePad", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x82, 0x1, 0xa, 0x37, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x3, 0x50, 0x61, 0x64, 0x2a, 0xf, 0xa, 0x4, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x4, 0x65, 0x64, 0x67, 0x65, 0xa0, 0x1, 0x3, 0x2a, 0x19, 0xa, 0x4, 0x70, 0x61, 0x64, 0x73, 0x40, 0x0, 0x40, 0x0, 0x40, 0x1, 0x40, 0x1, 0x40, 0x0, 0x40, 0x0, 0x40, 0x1, 0x40, 0x1, 0xa0, 0x1, 0x7, 0x12, 0xd, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x65, 0x64, 0x67, 0x65, 0x5f, 0x70, 0x61, 0x64, 0x5a, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x7, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x81, 0x1, 0xa, 0x22, 0xa, 0x1, 0x78, 0xa, 0x4, 0x70, 0x61, 0x64, 0x73, 0x12, 0x1, 0x79, 0x22, 0x3, 0x50, 0x61, 0x64, 0x2a, 0xf, 0xa, 0x4, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x4, 0x65, 0x64, 0x67, 0x65, 0xa0, 0x1, 0x3, 0x12, 0xd, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x65, 0x64, 0x67, 0x65, 0x5f, 0x70, 0x61, 0x64, 0x5a, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x16, 0xa, 0x14, 0x8, 0x6, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x5a, 0x12, 0xa, 0x4, 0x70, 0x61, 0x64, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x8, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x6, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x7, 0x42, 0x2, 0x10, 0xb}, /* &ir.NodeProto{ - Input: []string{"x"}, + Input: []string{"x", "pads"}, Output: []string{"y"}, Name: "", OpType: "Pad", - Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000119f00)(name:"mode" type:STRING s:"edge" ), - (*ir.AttributeProto)(0xc000132300)(name:"pads" type:INTS ints:0 ints:0 ints:1 ints:1 ints:0 ints:0 ints:1 ints:1 ) + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217500)(name:"mode" type:STRING s:"edge" ) } , }, @@ -39,14 +179,19 @@ func NewTestEdgePad() *testbackend.TestCase { tensor.New( tensor.WithShape(1, 3, 4, 5), - tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + tensor.WithBacking([]int32{1, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, -2, 0, 0, 0, 2, -1, 0, 0, 1, 1, 0, 0, 0, -1, 0, 0, 1, 1, 0, 0, -1, -1, -1, 1, 0, 0, -1, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0}), + ), + + tensor.New( + tensor.WithShape(8), + tensor.WithBacking([]int64{0, 0, 1, 1, 0, 0, 1, 1}), ), }, ExpectedOutput: []tensor.Tensor{ tensor.New( tensor.WithShape(1, 3, 6, 7), - tensor.WithBacking([]float32{1.7640524, 1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, 1.867558, 1.7640524, 1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, 1.867558, -0.9772779, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.41059852, 0.14404356, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.44386324, 0.33367434, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -0.85409576, 0.33367434, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -0.85409576, -2.5529897, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, 2.2697546, -2.5529897, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, 2.2697546, -1.4543657, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 1.4693588, 0.15494743, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, -0.34791216, 0.15634897, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -0.30230275, 0.15634897, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -0.30230275, -1.048553, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.5096522, -1.048553, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.5096522, -0.4380743, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.21274029, -0.89546657, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, -0.028182229, 0.42833188, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117, -0.36274117, 0.42833188, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117, -0.36274117}), + tensor.WithBacking([]int32{1, 1, 0, 0, 2, 1, 1, 1, 1, 0, 0, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -2, -2, 0, 0, 0, 2, 2, -2, -2, 0, 0, 0, 2, 2, -1, -1, 0, 0, 1, 1, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, -1, -1, -1, -1, 1, 0, 0, -1, -1, -1, -1, 1, 0, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}), ), }, } diff --git a/backend/testbackend/onnx/onnx_test_einsum_batch_diagonal.go b/backend/testbackend/onnx/onnx_test_einsum_batch_diagonal.go new file mode 100644 index 00000000..fcd6c0f0 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_einsum_batch_diagonal.go @@ -0,0 +1,161 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Einsum", "TestEinsumBatchDiagonal", NewTestEinsumBatchDiagonal) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Einsum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "equation", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x2e, 0x2e, 0x2e, 0x69, 0x69, 0x20, 0x2d, 0x3e, 0x2e, 0x2e, 0x2e, 0x69}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_einsum_batch_diagonal", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestEinsumBatchDiagonal version: 6. +func NewTestEinsumBatchDiagonal() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Einsum", + Title: "TestEinsumBatchDiagonal", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x77, 0xa, 0x2b, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x6, 0x45, 0x69, 0x6e, 0x73, 0x75, 0x6d, 0x2a, 0x1b, 0xa, 0x8, 0x65, 0x71, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xc, 0x2e, 0x2e, 0x2e, 0x69, 0x69, 0x20, 0x2d, 0x3e, 0x2e, 0x2e, 0x2e, 0x69, 0xa0, 0x1, 0x3, 0x12, 0x1a, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x65, 0x69, 0x6e, 0x73, 0x75, 0x6d, 0x5f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x69, 0x61, 0x67, 0x6f, 0x6e, 0x61, 0x6c, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0xb, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x5, 0xa, 0x2, 0x8, 0x5, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0xb, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Einsum", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217a00)(name:"equation" type:STRING s:"...ii ->...i" ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 5, 5), + tensor.WithBacking([]float64{1.764052345967664, 0.4001572083672233, 0.9787379841057392, 2.240893199201458, 1.8675579901499675, -0.977277879876411, 0.9500884175255894, -0.1513572082976979, -0.10321885179355784, 0.41059850193837233, 0.144043571160878, 1.454273506962975, 0.7610377251469934, 0.12167501649282841, 0.44386323274542566, 0.33367432737426683, 1.4940790731576061, -0.20515826376580087, 0.31306770165090136, -0.8540957393017248, -2.5529898158340787, 0.6536185954403606, 0.8644361988595057, -0.7421650204064419, 2.2697546239876076, -1.4543656745987648, 0.04575851730144607, -0.1871838500258336, 1.5327792143584575, 1.469358769900285, 0.1549474256969163, 0.37816251960217356, -0.8877857476301128, -1.980796468223927, -0.3479121493261526, 0.15634896910398005, 1.2302906807277207, 1.2023798487844113, -0.3873268174079523, -0.30230275057533557, -1.0485529650670926, -1.4200179371789752, -1.7062701906250126, 1.9507753952317897, -0.5096521817516535, -0.4380743016111864, -1.2527953600499262, 0.7774903558319101, -1.6138978475579515, -0.2127402802139687, -0.8954665611936756, 0.386902497859262, -0.510805137568873, -1.180632184122412, -0.028182228338654868, 0.42833187053041766, 0.06651722238316789, 0.3024718977397814, -0.6343220936809636, -0.3627411659871381, -0.672460447775951, -0.3595531615405413, -0.813146282044454, -1.7262826023316769, 0.17742614225375283, -0.4017809362082619, -1.6301983469660446, 0.4627822555257742, -0.9072983643832422, 0.05194539579613895, 0.7290905621775369, 0.12898291075741067, 1.1394006845433007, -1.2348258203536526, 0.402341641177549}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 5), + tensor.WithBacking([]float64{1.764052345967664, 0.9500884175255894, 0.7610377251469934, 0.31306770165090136, 2.2697546239876076, -1.4543656745987648, 0.37816251960217356, 1.2023798487844113, 1.9507753952317897, -0.2127402802139687, -0.8954665611936756, 0.06651722238316789, -0.813146282044454, -0.9072983643832422, 0.402341641177549}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_einsum_batch_diagonal_test.go b/backend/testbackend/onnx/onnx_test_einsum_batch_diagonal_test.go new file mode 100644 index 00000000..64d00dd8 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_einsum_batch_diagonal_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestEinsumBatchDiagonal(t *testing.T) { + mytest := NewTestEinsumBatchDiagonal() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_einsum_batch_matmul.go b/backend/testbackend/onnx/onnx_test_einsum_batch_matmul.go new file mode 100644 index 00000000..ebe12b06 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_einsum_batch_matmul.go @@ -0,0 +1,198 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Einsum", "TestEinsumBatchMatmul", NewTestEinsumBatchMatmul) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Einsum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "equation", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x62, 0x69, 0x6a, 0x2c, 0x20, 0x62, 0x6a, 0x6b, 0x20, 0x2d, 0x3e, 0x20, 0x62, 0x69, 0x6b}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_einsum_batch_matmul", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestEinsumBatchMatmul version: 6. +func NewTestEinsumBatchMatmul() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Einsum", + Title: "TestEinsumBatchMatmul", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x98, 0x1, 0xa, 0x31, 0xa, 0x1, 0x78, 0xa, 0x1, 0x79, 0x12, 0x1, 0x7a, 0x22, 0x6, 0x45, 0x69, 0x6e, 0x73, 0x75, 0x6d, 0x2a, 0x1e, 0xa, 0x8, 0x65, 0x71, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xf, 0x62, 0x69, 0x6a, 0x2c, 0x20, 0x62, 0x6a, 0x6b, 0x20, 0x2d, 0x3e, 0x20, 0x62, 0x69, 0x6b, 0xa0, 0x1, 0x3, 0x12, 0x18, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x65, 0x69, 0x6e, 0x73, 0x75, 0x6d, 0x5f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x6d, 0x61, 0x74, 0x6d, 0x75, 0x6c, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0xb, 0x12, 0xc, 0xa, 0x2, 0x8, 0x5, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0xb, 0x12, 0xc, 0xa, 0x2, 0x8, 0x5, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x62, 0x17, 0xa, 0x1, 0x7a, 0x12, 0x12, 0xa, 0x10, 0x8, 0xb, 0x12, 0xc, 0xa, 0x2, 0x8, 0x5, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"x", "y"}, + Output: []string{"z"}, + Name: "", + OpType: "Einsum", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000216b00)(name:"equation" type:STRING s:"bij, bjk -> bik" ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(5, 2, 3), + tensor.WithBacking([]float64{1.764052345967664, 0.4001572083672233, 0.9787379841057392, 2.240893199201458, 1.8675579901499675, -0.977277879876411, 0.9500884175255894, -0.1513572082976979, -0.10321885179355784, 0.41059850193837233, 0.144043571160878, 1.454273506962975, 0.7610377251469934, 0.12167501649282841, 0.44386323274542566, 0.33367432737426683, 1.4940790731576061, -0.20515826376580087, 0.31306770165090136, -0.8540957393017248, -2.5529898158340787, 0.6536185954403606, 0.8644361988595057, -0.7421650204064419, 2.2697546239876076, -1.4543656745987648, 0.04575851730144607, -0.1871838500258336, 1.5327792143584575, 1.469358769900285}), + ), + + tensor.New( + tensor.WithShape(5, 3, 4), + tensor.WithBacking([]float64{0.1549474256969163, 0.37816251960217356, -0.8877857476301128, -1.980796468223927, -0.3479121493261526, 0.15634896910398005, 1.2302906807277207, 1.2023798487844113, -0.3873268174079523, -0.30230275057533557, -1.0485529650670926, -1.4200179371789752, -1.7062701906250126, 1.9507753952317897, -0.5096521817516535, -0.4380743016111864, -1.2527953600499262, 0.7774903558319101, -1.6138978475579515, -0.2127402802139687, -0.8954665611936756, 0.386902497859262, -0.510805137568873, -1.180632184122412, -0.028182228338654868, 0.42833187053041766, 0.06651722238316789, 0.3024718977397814, -0.6343220936809636, -0.3627411659871381, -0.672460447775951, -0.3595531615405413, -0.813146282044454, -1.7262826023316769, 0.17742614225375283, -0.4017809362082619, -1.6301983469660446, 0.4627822555257742, -0.9072983643832422, 0.05194539579613895, 0.7290905621775369, 0.12898291075741067, 1.1394006845433007, -1.2348258203536526, 0.402341641177549, -0.6848100909403132, -0.8707971491818818, -0.5788496647644155, -0.31155253212737266, 0.05616534222974544, -1.1651498407833565, 0.9008264869541871, 0.46566243973045984, -1.5362436862772237, 1.4882521937955997, 1.8958891760305832, 1.1787795711596507, -0.17992483581235091, -1.0707526215105425, 1.0544517269311366}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(5, 2, 4), + tensor.WithBacking([]float64{-0.2449756530890492, 0.43378746218127495, -2.1000494618012033, -4.402913186196848, 0.07600044906940934, 1.4348463760343186, 1.3329337654266886, -0.8054871218198842, -1.339058906750601, 1.6957947068814332, -0.18721484237474798, -0.26214604663510777, -2.1833023980833026, 1.475639994712103, -1.1845844105749435, -1.9274786285080947, -0.45955462759799476, -0.48439320150081144, 0.047553420605969635, 0.008108102915400511, -0.7903073724831986, -0.04487949481849868, -1.0189144324021775, -0.3538450680307544, -2.1602497048529434, 1.7830316105326642, 0.9659331698437077, 2.5487191966595786, -0.7338795719749507, 0.9222226800617044, 1.0381872981434612, -0.6038736884980718, -1.3304520633035486, 2.353508536662, -4.858063196916035, -0.664410908697119, 2.5041254116379257, -2.629609770935472, 0.9259395066178495, 4.286727244116296}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_einsum_batch_matmul_test.go b/backend/testbackend/onnx/onnx_test_einsum_batch_matmul_test.go new file mode 100644 index 00000000..81827e3c --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_einsum_batch_matmul_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestEinsumBatchMatmul(t *testing.T) { + mytest := NewTestEinsumBatchMatmul() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_einsum_inner_prod.go b/backend/testbackend/onnx/onnx_test_einsum_inner_prod.go new file mode 100644 index 00000000..54bc9203 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_einsum_inner_prod.go @@ -0,0 +1,167 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Einsum", "TestEinsumInnerProd", NewTestEinsumInnerProd) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Einsum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "equation", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x69, 0x2c, 0x69}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_einsum_inner_prod", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestEinsumInnerProd version: 6. +func NewTestEinsumInnerProd() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Einsum", + Title: "TestEinsumInnerProd", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x6e, 0xa, 0x25, 0xa, 0x1, 0x78, 0xa, 0x1, 0x79, 0x12, 0x1, 0x7a, 0x22, 0x6, 0x45, 0x69, 0x6e, 0x73, 0x75, 0x6d, 0x2a, 0x12, 0xa, 0x8, 0x65, 0x71, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3, 0x69, 0x2c, 0x69, 0xa0, 0x1, 0x3, 0x12, 0x16, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x65, 0x69, 0x6e, 0x73, 0x75, 0x6d, 0x5f, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x5f, 0x70, 0x72, 0x6f, 0x64, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0xb, 0x12, 0x4, 0xa, 0x2, 0x8, 0x5, 0x5a, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0xb, 0x12, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0xb, 0xa, 0x1, 0x7a, 0x12, 0x6, 0xa, 0x4, 0x8, 0xb, 0x12, 0x0, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"x", "y"}, + Output: []string{"z"}, + Name: "", + OpType: "Einsum", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217100)(name:"equation" type:STRING s:"i,i" ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(5), + tensor.WithBacking([]float64{1.764052345967664, 0.4001572083672233, 0.9787379841057392, 2.240893199201458, 1.8675579901499675}), + ), + + tensor.New( + tensor.WithShape(5), + tensor.WithBacking([]float64{-0.977277879876411, 0.9500884175255894, -0.1513572082976979, -0.10321885179355784, 0.41059850193837233}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{-0.9564095667033291}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_einsum_inner_prod_test.go b/backend/testbackend/onnx/onnx_test_einsum_inner_prod_test.go new file mode 100644 index 00000000..96b6aa51 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_einsum_inner_prod_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestEinsumInnerProd(t *testing.T) { + mytest := NewTestEinsumInnerProd() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_einsum_sum.go b/backend/testbackend/onnx/onnx_test_einsum_sum.go new file mode 100644 index 00000000..88769e33 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_einsum_sum.go @@ -0,0 +1,153 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Einsum", "TestEinsumSum", NewTestEinsumSum) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Einsum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "equation", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x69, 0x6a, 0x2d, 0x3e, 0x69}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_einsum_sum", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestEinsumSum version: 6. +func NewTestEinsumSum() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Einsum", + Title: "TestEinsumSum", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x5d, 0xa, 0x24, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x6, 0x45, 0x69, 0x6e, 0x73, 0x75, 0x6d, 0x2a, 0x14, 0xa, 0x8, 0x65, 0x71, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x5, 0x69, 0x6a, 0x2d, 0x3e, 0x69, 0xa0, 0x1, 0x3, 0x12, 0xf, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x65, 0x69, 0x6e, 0x73, 0x75, 0x6d, 0x5f, 0x73, 0x75, 0x6d, 0x5a, 0x13, 0xa, 0x1, 0x78, 0x12, 0xe, 0xa, 0xc, 0x8, 0xb, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0xb, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Einsum", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217400)(name:"equation" type:STRING s:"ij->i" ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4), + tensor.WithBacking([]float64{1.764052345967664, 0.4001572083672233, 0.9787379841057392, 2.240893199201458, 1.8675579901499675, -0.977277879876411, 0.9500884175255894, -0.1513572082976979, -0.10321885179355784, 0.41059850193837233, 0.144043571160878, 1.454273506962975}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]float64{5.3838407376420845, 1.689011319501448, 1.9056967282686674}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_einsum_sum_test.go b/backend/testbackend/onnx/onnx_test_einsum_sum_test.go new file mode 100644 index 00000000..1edb2261 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_einsum_sum_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestEinsumSum(t *testing.T) { + mytest := NewTestEinsumSum() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_einsum_transpose.go b/backend/testbackend/onnx/onnx_test_einsum_transpose.go new file mode 100644 index 00000000..b4498614 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_einsum_transpose.go @@ -0,0 +1,157 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Einsum", "TestEinsumTranspose", NewTestEinsumTranspose) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Einsum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "equation", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x69, 0x6a, 0x2d, 0x3e, 0x6a, 0x69}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_einsum_transpose", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestEinsumTranspose version: 6. +func NewTestEinsumTranspose() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Einsum", + Title: "TestEinsumTranspose", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x68, 0xa, 0x25, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x6, 0x45, 0x69, 0x6e, 0x73, 0x75, 0x6d, 0x2a, 0x15, 0xa, 0x8, 0x65, 0x71, 0x75, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x6, 0x69, 0x6a, 0x2d, 0x3e, 0x6a, 0x69, 0xa0, 0x1, 0x3, 0x12, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x65, 0x69, 0x6e, 0x73, 0x75, 0x6d, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x73, 0x65, 0x5a, 0x13, 0xa, 0x1, 0x78, 0x12, 0xe, 0xa, 0xc, 0x8, 0xb, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0xb, 0x12, 0x8, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Einsum", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217700)(name:"equation" type:STRING s:"ij->ji" ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4), + tensor.WithBacking([]float64{1.764052345967664, 0.4001572083672233, 0.9787379841057392, 2.240893199201458, 1.8675579901499675, -0.977277879876411, 0.9500884175255894, -0.1513572082976979, -0.10321885179355784, 0.41059850193837233, 0.144043571160878, 1.454273506962975}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(4, 3), + tensor.WithBacking([]float64{1.764052345967664, 1.8675579901499675, -0.10321885179355784, 0.4001572083672233, -0.977277879876411, 0.41059850193837233, 0.9787379841057392, 0.9500884175255894, 0.144043571160878, 2.240893199201458, -0.1513572082976979, 1.454273506962975}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_einsum_transpose_test.go b/backend/testbackend/onnx/onnx_test_einsum_transpose_test.go new file mode 100644 index 00000000..db184884 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_einsum_transpose_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestEinsumTranspose(t *testing.T) { + mytest := NewTestEinsumTranspose() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_elu.go b/backend/testbackend/onnx/onnx_test_elu.go index 906c4bfd..32f7832a 100644 --- a/backend/testbackend/onnx/onnx_test_elu.go +++ b/backend/testbackend/onnx/onnx_test_elu.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("Elu", "TestElu", NewTestElu) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Elu", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "alpha", + RefAttrName: "", + DocString: "", + Type: 1, + F: 2, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_elu", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestElu version: 3. func NewTestElu() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestElu() *testbackend.TestCase { Name: "", OpType: "Elu", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000132a00)(name:"alpha" type:FLOAT f:2 ) + (*ir.AttributeProto)(0xc000217b00)(name:"alpha" type:FLOAT f:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_elu_default.go b/backend/testbackend/onnx/onnx_test_elu_default.go index e081e592..873263d0 100644 --- a/backend/testbackend/onnx/onnx_test_elu_default.go +++ b/backend/testbackend/onnx/onnx_test_elu_default.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Elu", "TestEluDefault", NewTestEluDefault) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Elu", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_elu_default", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestEluDefault version: 3. func NewTestEluDefault() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_elu_example.go b/backend/testbackend/onnx/onnx_test_elu_example.go index 290b9aa3..c8f49f8d 100644 --- a/backend/testbackend/onnx/onnx_test_elu_example.go +++ b/backend/testbackend/onnx/onnx_test_elu_example.go @@ -11,6 +11,103 @@ func init() { testbackend.Register("Elu", "TestEluExample", NewTestEluExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Elu", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "alpha", + RefAttrName: "", + DocString: "", + Type: 1, + F: 2, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_elu_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestEluExample version: 3. func NewTestEluExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +123,7 @@ func NewTestEluExample() *testbackend.TestCase { Name: "", OpType: "Elu", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000133500)(name:"alpha" type:FLOAT f:2 ) + (*ir.AttributeProto)(0xc0001e6600)(name:"alpha" type:FLOAT f:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_erf.go b/backend/testbackend/onnx/onnx_test_erf.go index 33d5f035..eececc05 100644 --- a/backend/testbackend/onnx/onnx_test_erf.go +++ b/backend/testbackend/onnx/onnx_test_erf.go @@ -11,6 +11,108 @@ func init() { testbackend.Register("Erf", "TestErf", NewTestErf) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Erf", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_erf", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestErf version: 3. func NewTestErf() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_exp.go b/backend/testbackend/onnx/onnx_test_exp.go index 2691248a..de4725cb 100644 --- a/backend/testbackend/onnx/onnx_test_exp.go +++ b/backend/testbackend/onnx/onnx_test_exp.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Exp", "TestExp", NewTestExp) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Exp", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_exp", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestExp version: 3. func NewTestExp() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_exp_example.go b/backend/testbackend/onnx/onnx_test_exp_example.go index 5876aff0..c37e9bdc 100644 --- a/backend/testbackend/onnx/onnx_test_exp_example.go +++ b/backend/testbackend/onnx/onnx_test_exp_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Exp", "TestExpExample", NewTestExpExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Exp", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_exp_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestExpExample version: 3. func NewTestExpExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_expand_dim_changed.go b/backend/testbackend/onnx/onnx_test_expand_dim_changed.go index 068fb5a6..b863243b 100644 --- a/backend/testbackend/onnx/onnx_test_expand_dim_changed.go +++ b/backend/testbackend/onnx/onnx_test_expand_dim_changed.go @@ -11,6 +11,116 @@ func init() { testbackend.Register("Expand", "TestExpandDimChanged", NewTestExpandDimChanged) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "new_shape"}, + Output: {"expanded"}, + Name: "", + OpType: "Expand", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_expand_dim_changed", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "new_shape", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "expanded", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestExpandDimChanged version: 3. func NewTestExpandDimChanged() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_expand_dim_unchanged.go b/backend/testbackend/onnx/onnx_test_expand_dim_unchanged.go index 40db7fef..7263c197 100644 --- a/backend/testbackend/onnx/onnx_test_expand_dim_unchanged.go +++ b/backend/testbackend/onnx/onnx_test_expand_dim_unchanged.go @@ -11,6 +11,112 @@ func init() { testbackend.Register("Expand", "TestExpandDimUnchanged", NewTestExpandDimUnchanged) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "new_shape"}, + Output: {"expanded"}, + Name: "", + OpType: "Expand", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_expand_dim_unchanged", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "new_shape", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "expanded", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestExpandDimUnchanged version: 3. func NewTestExpandDimUnchanged() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_eyelike_populate_off_main_diagonal.go b/backend/testbackend/onnx/onnx_test_eyelike_populate_off_main_diagonal.go index ed1afb70..9fc575a4 100644 --- a/backend/testbackend/onnx/onnx_test_eyelike_populate_off_main_diagonal.go +++ b/backend/testbackend/onnx/onnx_test_eyelike_populate_off_main_diagonal.go @@ -11,6 +11,129 @@ func init() { testbackend.Register("EyeLike", "TestEyelikePopulateOffMainDiagonal", NewTestEyelikePopulateOffMainDiagonal) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "EyeLike", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "dtype", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "k", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_eyelike_populate_off_main_diagonal", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestEyelikePopulateOffMainDiagonal version: 3. func NewTestEyelikePopulateOffMainDiagonal() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +149,8 @@ func NewTestEyelikePopulateOffMainDiagonal() *testbackend.TestCase { Name: "", OpType: "EyeLike", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000119600)(name:"dtype" type:INT i:1 ), - (*ir.AttributeProto)(0xc000119700)(name:"k" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217500)(name:"dtype" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217600)(name:"k" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_eyelike_with_dtype.go b/backend/testbackend/onnx/onnx_test_eyelike_with_dtype.go index fe7941fe..6b5c1736 100644 --- a/backend/testbackend/onnx/onnx_test_eyelike_with_dtype.go +++ b/backend/testbackend/onnx/onnx_test_eyelike_with_dtype.go @@ -11,6 +11,111 @@ func init() { testbackend.Register("EyeLike", "TestEyelikeWithDtype", NewTestEyelikeWithDtype) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "EyeLike", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "dtype", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 11, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_eyelike_with_dtype", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestEyelikeWithDtype version: 3. func NewTestEyelikeWithDtype() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +131,7 @@ func NewTestEyelikeWithDtype() *testbackend.TestCase { Name: "", OpType: "EyeLike", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000132900)(name:"dtype" type:INT i:11 ) + (*ir.AttributeProto)(0xc000216f00)(name:"dtype" type:INT i:11 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_eyelike_without_dtype.go b/backend/testbackend/onnx/onnx_test_eyelike_without_dtype.go index 37124848..97fdb130 100644 --- a/backend/testbackend/onnx/onnx_test_eyelike_without_dtype.go +++ b/backend/testbackend/onnx/onnx_test_eyelike_without_dtype.go @@ -11,6 +11,92 @@ func init() { testbackend.Register("EyeLike", "TestEyelikeWithoutDtype", NewTestEyelikeWithoutDtype) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "EyeLike", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_eyelike_without_dtype", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestEyelikeWithoutDtype version: 3. func NewTestEyelikeWithoutDtype() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_flatten_axis0.go b/backend/testbackend/onnx/onnx_test_flatten_axis0.go index f890f17f..b0097916 100644 --- a/backend/testbackend/onnx/onnx_test_flatten_axis0.go +++ b/backend/testbackend/onnx/onnx_test_flatten_axis0.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("Flatten", "TestFlattenAxis0", NewTestFlattenAxis0) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a"}, + Output: {"b"}, + Name: "", + OpType: "Flatten", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_flatten_axis0", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:120}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestFlattenAxis0 version: 3. func NewTestFlattenAxis0() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestFlattenAxis0() *testbackend.TestCase { Name: "", OpType: "Flatten", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000119d00)(name:"axis" type:INT ) + (*ir.AttributeProto)(0xc000217800)(name:"axis" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_flatten_axis1.go b/backend/testbackend/onnx/onnx_test_flatten_axis1.go index 8434ce0a..563a8cde 100644 --- a/backend/testbackend/onnx/onnx_test_flatten_axis1.go +++ b/backend/testbackend/onnx/onnx_test_flatten_axis1.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("Flatten", "TestFlattenAxis1", NewTestFlattenAxis1) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a"}, + Output: {"b"}, + Name: "", + OpType: "Flatten", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_flatten_axis1", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:60}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestFlattenAxis1 version: 3. func NewTestFlattenAxis1() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestFlattenAxis1() *testbackend.TestCase { Name: "", OpType: "Flatten", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126400)(name:"axis" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217c00)(name:"axis" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_flatten_axis2.go b/backend/testbackend/onnx/onnx_test_flatten_axis2.go index d8059bbc..c6609013 100644 --- a/backend/testbackend/onnx/onnx_test_flatten_axis2.go +++ b/backend/testbackend/onnx/onnx_test_flatten_axis2.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("Flatten", "TestFlattenAxis2", NewTestFlattenAxis2) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a"}, + Output: {"b"}, + Name: "", + OpType: "Flatten", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_flatten_axis2", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:20}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestFlattenAxis2 version: 3. func NewTestFlattenAxis2() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestFlattenAxis2() *testbackend.TestCase { Name: "", OpType: "Flatten", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126500)(name:"axis" type:INT i:2 ) + (*ir.AttributeProto)(0xc0001e6100)(name:"axis" type:INT i:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_flatten_axis3.go b/backend/testbackend/onnx/onnx_test_flatten_axis3.go index f0e2605d..e35f5be9 100644 --- a/backend/testbackend/onnx/onnx_test_flatten_axis3.go +++ b/backend/testbackend/onnx/onnx_test_flatten_axis3.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("Flatten", "TestFlattenAxis3", NewTestFlattenAxis3) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a"}, + Output: {"b"}, + Name: "", + OpType: "Flatten", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 3, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_flatten_axis3", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:24}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestFlattenAxis3 version: 3. func NewTestFlattenAxis3() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestFlattenAxis3() *testbackend.TestCase { Name: "", OpType: "Flatten", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126b00)(name:"axis" type:INT i:3 ) + (*ir.AttributeProto)(0xc0001e6700)(name:"axis" type:INT i:3 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_flatten_default_axis.go b/backend/testbackend/onnx/onnx_test_flatten_default_axis.go index 3e99ef83..7b8a5522 100644 --- a/backend/testbackend/onnx/onnx_test_flatten_default_axis.go +++ b/backend/testbackend/onnx/onnx_test_flatten_default_axis.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Flatten", "TestFlattenDefaultAxis", NewTestFlattenDefaultAxis) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a"}, + Output: {"b"}, + Name: "", + OpType: "Flatten", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_flatten_default_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:24}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestFlattenDefaultAxis version: 3. func NewTestFlattenDefaultAxis() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_flatten_negative_axis1.go b/backend/testbackend/onnx/onnx_test_flatten_negative_axis1.go new file mode 100644 index 00000000..e2951591 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_flatten_negative_axis1.go @@ -0,0 +1,165 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Flatten", "TestFlattenNegativeAxis1", NewTestFlattenNegativeAxis1) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a"}, + Output: {"b"}, + Name: "", + OpType: "Flatten", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_flatten_negative_axis1", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:24}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestFlattenNegativeAxis1 version: 6. +func NewTestFlattenNegativeAxis1() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Flatten", + Title: "TestFlattenNegativeAxis1", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x76, 0xa, 0x25, 0xa, 0x1, 0x61, 0x12, 0x1, 0x62, 0x22, 0x7, 0x46, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1b, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x31, 0x5a, 0x1b, 0xa, 0x1, 0x61, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x13, 0xa, 0x1, 0x62, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x18, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"a"}, + Output: []string{"b"}, + Name: "", + OpType: "Flatten", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000216b00)(name:"axis" type:INT i:-1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4, 5), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256, 0.15896958, 0.11037514, 0.6563296, 0.13818295, 0.19658236, 0.36872518, 0.82099324, 0.09710128, 0.8379449, 0.09609841, 0.97645944, 0.4686512, 0.9767611, 0.6048455, 0.7392636, 0.039187793, 0.28280696, 0.12019656, 0.2961402, 0.11872772, 0.31798318, 0.41426298, 0.064147495, 0.6924721, 0.56660146, 0.2653895, 0.5232481, 0.09394051, 0.5759465, 0.9292962, 0.31856894, 0.6674104, 0.13179787, 0.7163272, 0.2894061, 0.18319136, 0.5865129, 0.020107547, 0.82894003, 0.004695476, 0.6778165, 0.27000797, 0.735194, 0.96218854, 0.24875315, 0.57615733, 0.5920419, 0.5722519, 0.22308163, 0.952749, 0.44712538, 0.84640867, 0.6994793, 0.29743695, 0.81379783, 0.39650574, 0.8811032, 0.5812729, 0.8817354, 0.6925316}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(24, 5), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256, 0.15896958, 0.11037514, 0.6563296, 0.13818295, 0.19658236, 0.36872518, 0.82099324, 0.09710128, 0.8379449, 0.09609841, 0.97645944, 0.4686512, 0.9767611, 0.6048455, 0.7392636, 0.039187793, 0.28280696, 0.12019656, 0.2961402, 0.11872772, 0.31798318, 0.41426298, 0.064147495, 0.6924721, 0.56660146, 0.2653895, 0.5232481, 0.09394051, 0.5759465, 0.9292962, 0.31856894, 0.6674104, 0.13179787, 0.7163272, 0.2894061, 0.18319136, 0.5865129, 0.020107547, 0.82894003, 0.004695476, 0.6778165, 0.27000797, 0.735194, 0.96218854, 0.24875315, 0.57615733, 0.5920419, 0.5722519, 0.22308163, 0.952749, 0.44712538, 0.84640867, 0.6994793, 0.29743695, 0.81379783, 0.39650574, 0.8811032, 0.5812729, 0.8817354, 0.6925316}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_flatten_negative_axis1_test.go b/backend/testbackend/onnx/onnx_test_flatten_negative_axis1_test.go new file mode 100644 index 00000000..fa00de27 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_flatten_negative_axis1_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestFlattenNegativeAxis1(t *testing.T) { + mytest := NewTestFlattenNegativeAxis1() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_flatten_negative_axis2.go b/backend/testbackend/onnx/onnx_test_flatten_negative_axis2.go new file mode 100644 index 00000000..9237b700 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_flatten_negative_axis2.go @@ -0,0 +1,165 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Flatten", "TestFlattenNegativeAxis2", NewTestFlattenNegativeAxis2) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a"}, + Output: {"b"}, + Name: "", + OpType: "Flatten", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_flatten_negative_axis2", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:20}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestFlattenNegativeAxis2 version: 6. +func NewTestFlattenNegativeAxis2() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Flatten", + Title: "TestFlattenNegativeAxis2", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x76, 0xa, 0x25, 0xa, 0x1, 0x61, 0x12, 0x1, 0x62, 0x22, 0x7, 0x46, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1b, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x32, 0x5a, 0x1b, 0xa, 0x1, 0x61, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x13, 0xa, 0x1, 0x62, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x14, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"a"}, + Output: []string{"b"}, + Name: "", + OpType: "Flatten", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000216f00)(name:"axis" type:INT i:-2 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4, 5), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256, 0.15896958, 0.11037514, 0.6563296, 0.13818295, 0.19658236, 0.36872518, 0.82099324, 0.09710128, 0.8379449, 0.09609841, 0.97645944, 0.4686512, 0.9767611, 0.6048455, 0.7392636, 0.039187793, 0.28280696, 0.12019656, 0.2961402, 0.11872772, 0.31798318, 0.41426298, 0.064147495, 0.6924721, 0.56660146, 0.2653895, 0.5232481, 0.09394051, 0.5759465, 0.9292962, 0.31856894, 0.6674104, 0.13179787, 0.7163272, 0.2894061, 0.18319136, 0.5865129, 0.020107547, 0.82894003, 0.004695476, 0.6778165, 0.27000797, 0.735194, 0.96218854, 0.24875315, 0.57615733, 0.5920419, 0.5722519, 0.22308163, 0.952749, 0.44712538, 0.84640867, 0.6994793, 0.29743695, 0.81379783, 0.39650574, 0.8811032, 0.5812729, 0.8817354, 0.6925316}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(6, 20), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256, 0.15896958, 0.11037514, 0.6563296, 0.13818295, 0.19658236, 0.36872518, 0.82099324, 0.09710128, 0.8379449, 0.09609841, 0.97645944, 0.4686512, 0.9767611, 0.6048455, 0.7392636, 0.039187793, 0.28280696, 0.12019656, 0.2961402, 0.11872772, 0.31798318, 0.41426298, 0.064147495, 0.6924721, 0.56660146, 0.2653895, 0.5232481, 0.09394051, 0.5759465, 0.9292962, 0.31856894, 0.6674104, 0.13179787, 0.7163272, 0.2894061, 0.18319136, 0.5865129, 0.020107547, 0.82894003, 0.004695476, 0.6778165, 0.27000797, 0.735194, 0.96218854, 0.24875315, 0.57615733, 0.5920419, 0.5722519, 0.22308163, 0.952749, 0.44712538, 0.84640867, 0.6994793, 0.29743695, 0.81379783, 0.39650574, 0.8811032, 0.5812729, 0.8817354, 0.6925316}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_flatten_negative_axis2_test.go b/backend/testbackend/onnx/onnx_test_flatten_negative_axis2_test.go new file mode 100644 index 00000000..61f9f2ef --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_flatten_negative_axis2_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestFlattenNegativeAxis2(t *testing.T) { + mytest := NewTestFlattenNegativeAxis2() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_flatten_negative_axis3.go b/backend/testbackend/onnx/onnx_test_flatten_negative_axis3.go new file mode 100644 index 00000000..d9459a70 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_flatten_negative_axis3.go @@ -0,0 +1,165 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Flatten", "TestFlattenNegativeAxis3", NewTestFlattenNegativeAxis3) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a"}, + Output: {"b"}, + Name: "", + OpType: "Flatten", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -3, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_flatten_negative_axis3", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:60}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestFlattenNegativeAxis3 version: 6. +func NewTestFlattenNegativeAxis3() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Flatten", + Title: "TestFlattenNegativeAxis3", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x76, 0xa, 0x25, 0xa, 0x1, 0x61, 0x12, 0x1, 0x62, 0x22, 0x7, 0x46, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1b, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x33, 0x5a, 0x1b, 0xa, 0x1, 0x61, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x13, 0xa, 0x1, 0x62, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3c, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"a"}, + Output: []string{"b"}, + Name: "", + OpType: "Flatten", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217300)(name:"axis" type:INT i:-3 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4, 5), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256, 0.15896958, 0.11037514, 0.6563296, 0.13818295, 0.19658236, 0.36872518, 0.82099324, 0.09710128, 0.8379449, 0.09609841, 0.97645944, 0.4686512, 0.9767611, 0.6048455, 0.7392636, 0.039187793, 0.28280696, 0.12019656, 0.2961402, 0.11872772, 0.31798318, 0.41426298, 0.064147495, 0.6924721, 0.56660146, 0.2653895, 0.5232481, 0.09394051, 0.5759465, 0.9292962, 0.31856894, 0.6674104, 0.13179787, 0.7163272, 0.2894061, 0.18319136, 0.5865129, 0.020107547, 0.82894003, 0.004695476, 0.6778165, 0.27000797, 0.735194, 0.96218854, 0.24875315, 0.57615733, 0.5920419, 0.5722519, 0.22308163, 0.952749, 0.44712538, 0.84640867, 0.6994793, 0.29743695, 0.81379783, 0.39650574, 0.8811032, 0.5812729, 0.8817354, 0.6925316}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 60), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256, 0.15896958, 0.11037514, 0.6563296, 0.13818295, 0.19658236, 0.36872518, 0.82099324, 0.09710128, 0.8379449, 0.09609841, 0.97645944, 0.4686512, 0.9767611, 0.6048455, 0.7392636, 0.039187793, 0.28280696, 0.12019656, 0.2961402, 0.11872772, 0.31798318, 0.41426298, 0.064147495, 0.6924721, 0.56660146, 0.2653895, 0.5232481, 0.09394051, 0.5759465, 0.9292962, 0.31856894, 0.6674104, 0.13179787, 0.7163272, 0.2894061, 0.18319136, 0.5865129, 0.020107547, 0.82894003, 0.004695476, 0.6778165, 0.27000797, 0.735194, 0.96218854, 0.24875315, 0.57615733, 0.5920419, 0.5722519, 0.22308163, 0.952749, 0.44712538, 0.84640867, 0.6994793, 0.29743695, 0.81379783, 0.39650574, 0.8811032, 0.5812729, 0.8817354, 0.6925316}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_flatten_negative_axis3_test.go b/backend/testbackend/onnx/onnx_test_flatten_negative_axis3_test.go new file mode 100644 index 00000000..7e8d810b --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_flatten_negative_axis3_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestFlattenNegativeAxis3(t *testing.T) { + mytest := NewTestFlattenNegativeAxis3() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_flatten_negative_axis4.go b/backend/testbackend/onnx/onnx_test_flatten_negative_axis4.go new file mode 100644 index 00000000..6d2a1dc7 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_flatten_negative_axis4.go @@ -0,0 +1,165 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Flatten", "TestFlattenNegativeAxis4", NewTestFlattenNegativeAxis4) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a"}, + Output: {"b"}, + Name: "", + OpType: "Flatten", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -4, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_flatten_negative_axis4", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:120}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestFlattenNegativeAxis4 version: 6. +func NewTestFlattenNegativeAxis4() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Flatten", + Title: "TestFlattenNegativeAxis4", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x76, 0xa, 0x25, 0xa, 0x1, 0x61, 0x12, 0x1, 0x62, 0x22, 0x7, 0x46, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1b, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x34, 0x5a, 0x1b, 0xa, 0x1, 0x61, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x13, 0xa, 0x1, 0x62, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x78, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"a"}, + Output: []string{"b"}, + Name: "", + OpType: "Flatten", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217700)(name:"axis" type:INT i:-4 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4, 5), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256, 0.15896958, 0.11037514, 0.6563296, 0.13818295, 0.19658236, 0.36872518, 0.82099324, 0.09710128, 0.8379449, 0.09609841, 0.97645944, 0.4686512, 0.9767611, 0.6048455, 0.7392636, 0.039187793, 0.28280696, 0.12019656, 0.2961402, 0.11872772, 0.31798318, 0.41426298, 0.064147495, 0.6924721, 0.56660146, 0.2653895, 0.5232481, 0.09394051, 0.5759465, 0.9292962, 0.31856894, 0.6674104, 0.13179787, 0.7163272, 0.2894061, 0.18319136, 0.5865129, 0.020107547, 0.82894003, 0.004695476, 0.6778165, 0.27000797, 0.735194, 0.96218854, 0.24875315, 0.57615733, 0.5920419, 0.5722519, 0.22308163, 0.952749, 0.44712538, 0.84640867, 0.6994793, 0.29743695, 0.81379783, 0.39650574, 0.8811032, 0.5812729, 0.8817354, 0.6925316}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 120), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256, 0.15896958, 0.11037514, 0.6563296, 0.13818295, 0.19658236, 0.36872518, 0.82099324, 0.09710128, 0.8379449, 0.09609841, 0.97645944, 0.4686512, 0.9767611, 0.6048455, 0.7392636, 0.039187793, 0.28280696, 0.12019656, 0.2961402, 0.11872772, 0.31798318, 0.41426298, 0.064147495, 0.6924721, 0.56660146, 0.2653895, 0.5232481, 0.09394051, 0.5759465, 0.9292962, 0.31856894, 0.6674104, 0.13179787, 0.7163272, 0.2894061, 0.18319136, 0.5865129, 0.020107547, 0.82894003, 0.004695476, 0.6778165, 0.27000797, 0.735194, 0.96218854, 0.24875315, 0.57615733, 0.5920419, 0.5722519, 0.22308163, 0.952749, 0.44712538, 0.84640867, 0.6994793, 0.29743695, 0.81379783, 0.39650574, 0.8811032, 0.5812729, 0.8817354, 0.6925316}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_flatten_negative_axis4_test.go b/backend/testbackend/onnx/onnx_test_flatten_negative_axis4_test.go new file mode 100644 index 00000000..dfc11e3d --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_flatten_negative_axis4_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestFlattenNegativeAxis4(t *testing.T) { + mytest := NewTestFlattenNegativeAxis4() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_floor.go b/backend/testbackend/onnx/onnx_test_floor.go index 754f1d37..3e828f24 100644 --- a/backend/testbackend/onnx/onnx_test_floor.go +++ b/backend/testbackend/onnx/onnx_test_floor.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Floor", "TestFloor", NewTestFloor) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Floor", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_floor", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestFloor version: 3. func NewTestFloor() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_floor_example.go b/backend/testbackend/onnx/onnx_test_floor_example.go index 1739dec0..0ae189bb 100644 --- a/backend/testbackend/onnx/onnx_test_floor_example.go +++ b/backend/testbackend/onnx/onnx_test_floor_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Floor", "TestFloorExample", NewTestFloorExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Floor", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_floor_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestFloorExample version: 3. func NewTestFloorExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_gather_0.go b/backend/testbackend/onnx/onnx_test_gather_0.go index 1a8e9ba5..6a1bbdd9 100644 --- a/backend/testbackend/onnx/onnx_test_gather_0.go +++ b/backend/testbackend/onnx/onnx_test_gather_0.go @@ -11,6 +11,147 @@ func init() { testbackend.Register("Gather", "TestGather0", NewTestGather0) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "indices"}, + Output: {"y"}, + Name: "", + OpType: "Gather", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_gather_0", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestGather0 version: 3. func NewTestGather0() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +167,7 @@ func NewTestGather0() *testbackend.TestCase { Name: "", OpType: "Gather", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000133c00)(name:"axis" type:INT ) + (*ir.AttributeProto)(0xc000217f00)(name:"axis" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_gather_1.go b/backend/testbackend/onnx/onnx_test_gather_1.go index 0783aab5..5dafa9d1 100644 --- a/backend/testbackend/onnx/onnx_test_gather_1.go +++ b/backend/testbackend/onnx/onnx_test_gather_1.go @@ -11,6 +11,147 @@ func init() { testbackend.Register("Gather", "TestGather1", NewTestGather1) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "indices"}, + Output: {"y"}, + Name: "", + OpType: "Gather", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_gather_1", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestGather1 version: 3. func NewTestGather1() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +167,7 @@ func NewTestGather1() *testbackend.TestCase { Name: "", OpType: "Gather", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000118400)(name:"axis" type:INT i:1 ) + (*ir.AttributeProto)(0xc000216f00)(name:"axis" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_gather_elements_0.go b/backend/testbackend/onnx/onnx_test_gather_elements_0.go new file mode 100644 index 00000000..fdb116ed --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gather_elements_0.go @@ -0,0 +1,186 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("GatherElements", "TestGatherElements0", NewTestGatherElements0) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "indices"}, + Output: {"y"}, + Name: "", + OpType: "GatherElements", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_gather_elements_0", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestGatherElements0 version: 5. +func NewTestGatherElements0() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "GatherElements", + Title: "TestGatherElements0", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x91, 0x1, 0xa, 0x2f, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0xe, 0x47, 0x61, 0x74, 0x68, 0x65, 0x72, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x16, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x61, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x30, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data", "indices"}, + Output: []string{"y"}, + Name: "", + OpType: "GatherElements", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217400)(name:"axis" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{1, 2, 3, 4}), + ), + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]int64{0, 0, 1, 0}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{1, 1, 4, 3}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_gather_elements_0_test.go b/backend/testbackend/onnx/onnx_test_gather_elements_0_test.go new file mode 100644 index 00000000..7340cfee --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gather_elements_0_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestGatherElements0(t *testing.T) { + mytest := NewTestGatherElements0() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_gather_elements_1.go b/backend/testbackend/onnx/onnx_test_gather_elements_1.go new file mode 100644 index 00000000..2b366268 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gather_elements_1.go @@ -0,0 +1,186 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("GatherElements", "TestGatherElements1", NewTestGatherElements1) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "indices"}, + Output: {"y"}, + Name: "", + OpType: "GatherElements", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_gather_elements_1", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestGatherElements1 version: 5. +func NewTestGatherElements1() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "GatherElements", + Title: "TestGatherElements1", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x91, 0x1, 0xa, 0x2f, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0xe, 0x47, 0x61, 0x74, 0x68, 0x65, 0x72, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x0, 0xa0, 0x1, 0x2, 0x12, 0x16, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x61, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x31, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data", "indices"}, + Output: []string{"y"}, + Name: "", + OpType: "GatherElements", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217700)(name:"axis" type:INT ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 3), + tensor.WithBacking([]float32{1, 2, 3, 4, 5, 6, 7, 8, 9}), + ), + + tensor.New( + tensor.WithShape(2, 3), + tensor.WithBacking([]int64{1, 2, 0, 2, 0, 0}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3), + tensor.WithBacking([]float32{4, 8, 3, 7, 2, 3}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_gather_elements_1_test.go b/backend/testbackend/onnx/onnx_test_gather_elements_1_test.go new file mode 100644 index 00000000..e523615e --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gather_elements_1_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestGatherElements1(t *testing.T) { + mytest := NewTestGatherElements1() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_gather_elements_negative_indices.go b/backend/testbackend/onnx/onnx_test_gather_elements_negative_indices.go new file mode 100644 index 00000000..40cbc960 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gather_elements_negative_indices.go @@ -0,0 +1,186 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("GatherElements", "TestGatherElementsNegativeIndices", NewTestGatherElementsNegativeIndices) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "indices"}, + Output: {"y"}, + Name: "", + OpType: "GatherElements", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_gather_elements_negative_indices", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestGatherElementsNegativeIndices version: 6. +func NewTestGatherElementsNegativeIndices() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "GatherElements", + Title: "TestGatherElementsNegativeIndices", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xa0, 0x1, 0xa, 0x2f, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0xe, 0x47, 0x61, 0x74, 0x68, 0x65, 0x72, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x0, 0xa0, 0x1, 0x2, 0x12, 0x25, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x61, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data", "indices"}, + Output: []string{"y"}, + Name: "", + OpType: "GatherElements", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217b00)(name:"axis" type:INT ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 3), + tensor.WithBacking([]float32{1, 2, 3, 4, 5, 6, 7, 8, 9}), + ), + + tensor.New( + tensor.WithShape(2, 3), + tensor.WithBacking([]int64{-1, -2, 0, -2, 0, 0}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3), + tensor.WithBacking([]float32{7, 5, 3, 4, 2, 3}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_gather_elements_negative_indices_test.go b/backend/testbackend/onnx/onnx_test_gather_elements_negative_indices_test.go new file mode 100644 index 00000000..6eefeabe --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gather_elements_negative_indices_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestGatherElementsNegativeIndices(t *testing.T) { + mytest := NewTestGatherElementsNegativeIndices() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_gather_negative_indices.go b/backend/testbackend/onnx/onnx_test_gather_negative_indices.go new file mode 100644 index 00000000..94876909 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gather_negative_indices.go @@ -0,0 +1,174 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Gather", "TestGatherNegativeIndices", NewTestGatherNegativeIndices) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "indices"}, + Output: {"y"}, + Name: "", + OpType: "Gather", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_gather_negative_indices", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestGatherNegativeIndices version: 6. +func NewTestGatherNegativeIndices() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Gather", + Title: "TestGatherNegativeIndices", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x83, 0x1, 0xa, 0x27, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0x6, 0x47, 0x61, 0x74, 0x68, 0x65, 0x72, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x0, 0xa0, 0x1, 0x2, 0x12, 0x1c, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x61, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x5a, 0x12, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0xa, 0x5a, 0x15, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data", "indices"}, + Output: []string{"y"}, + Name: "", + OpType: "Gather", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0001e6100)(name:"axis" type:INT ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(10), + tensor.WithBacking([]float32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}), + ), + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]int64{0, -9, -10}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]float32{0, 1, 0}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_gather_negative_indices_test.go b/backend/testbackend/onnx/onnx_test_gather_negative_indices_test.go new file mode 100644 index 00000000..dabe38ec --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gather_negative_indices_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestGatherNegativeIndices(t *testing.T) { + mytest := NewTestGatherNegativeIndices() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_gathernd_example_float32.go b/backend/testbackend/onnx/onnx_test_gathernd_example_float32.go new file mode 100644 index 00000000..471a54f3 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gathernd_example_float32.go @@ -0,0 +1,177 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("GatherND", "TestGatherndExampleFloat32", NewTestGatherndExampleFloat32) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "indices"}, + Output: {"output"}, + Name: "", + OpType: "GatherND", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_gathernd_example_float32", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestGatherndExampleFloat32 version: 6. +func NewTestGatherndExampleFloat32() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "GatherND", + Title: "TestGatherndExampleFloat32", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x9b, 0x1, 0xa, 0x21, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0x8, 0x47, 0x61, 0x74, 0x68, 0x65, 0x72, 0x4e, 0x44, 0x12, 0x1d, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x61, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x64, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x33, 0x32, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x1d, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0x12, 0xa, 0x10, 0x8, 0x7, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1c, 0xa, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data", "indices"}, + Output: []string{"output"}, + Name: "", + OpType: "GatherND", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2, 2), + tensor.WithBacking([]float32{0, 1, 2, 3, 4, 5, 6, 7}), + ), + + tensor.New( + tensor.WithShape(2, 1, 2), + tensor.WithBacking([]int64{0, 1, 1, 0}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 1, 2), + tensor.WithBacking([]float32{2, 3, 4, 5}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_gathernd_example_float32_test.go b/backend/testbackend/onnx/onnx_test_gathernd_example_float32_test.go new file mode 100644 index 00000000..d01cf6d9 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gathernd_example_float32_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestGatherndExampleFloat32(t *testing.T) { + mytest := NewTestGatherndExampleFloat32() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_gathernd_example_int32.go b/backend/testbackend/onnx/onnx_test_gathernd_example_int32.go new file mode 100644 index 00000000..1d2bd7a3 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gathernd_example_int32.go @@ -0,0 +1,161 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("GatherND", "TestGatherndExampleInt32", NewTestGatherndExampleInt32) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "indices"}, + Output: {"output"}, + Name: "", + OpType: "GatherND", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_gathernd_example_int32", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestGatherndExampleInt32 version: 6. +func NewTestGatherndExampleInt32() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "GatherND", + Title: "TestGatherndExampleInt32", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x89, 0x1, 0xa, 0x21, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0x8, 0x47, 0x61, 0x74, 0x68, 0x65, 0x72, 0x4e, 0x44, 0x12, 0x1b, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x61, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x64, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x6, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x14, 0xa, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0xa, 0xa, 0x8, 0x8, 0x6, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data", "indices"}, + Output: []string{"output"}, + Name: "", + OpType: "GatherND", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]int32{0, 1, 2, 3}), + ), + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]int64{0, 0, 1, 1}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2), + tensor.WithBacking([]int32{0, 3}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_gathernd_example_int32_test.go b/backend/testbackend/onnx/onnx_test_gathernd_example_int32_test.go new file mode 100644 index 00000000..8c7ccbe2 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gathernd_example_int32_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestGatherndExampleInt32(t *testing.T) { + mytest := NewTestGatherndExampleInt32() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_all_attributes.go b/backend/testbackend/onnx/onnx_test_gemm_all_attributes.go new file mode 100644 index 00000000..1acd6d7b --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_all_attributes.go @@ -0,0 +1,272 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Gemm", "TestGemmAllAttributes", NewTestGemmAllAttributes) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a", "b", "c"}, + Output: {"y"}, + Name: "", + OpType: "Gemm", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "alpha", + RefAttrName: "", + DocString: "", + Type: 1, + F: 0.25, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "beta", + RefAttrName: "", + DocString: "", + Type: 1, + F: 0.3499999940395355, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "transA", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "transB", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_gemm_all_attributes", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "c", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestGemmAllAttributes version: 6. +func NewTestGemmAllAttributes() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Gemm", + Title: "TestGemmAllAttributes", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xc1, 0x1, 0xa, 0x51, 0xa, 0x1, 0x61, 0xa, 0x1, 0x62, 0xa, 0x1, 0x63, 0x12, 0x1, 0x79, 0x22, 0x4, 0x47, 0x65, 0x6d, 0x6d, 0x2a, 0xf, 0xa, 0x5, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x15, 0x0, 0x0, 0x80, 0x3e, 0xa0, 0x1, 0x1, 0x2a, 0xe, 0xa, 0x4, 0x62, 0x65, 0x74, 0x61, 0x15, 0x33, 0x33, 0xb3, 0x3e, 0xa0, 0x1, 0x1, 0x2a, 0xd, 0xa, 0x6, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x41, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xd, 0xa, 0x6, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x42, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x18, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x65, 0x6d, 0x6d, 0x5f, 0x61, 0x6c, 0x6c, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x5a, 0x13, 0xa, 0x1, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x13, 0xa, 0x1, 0x62, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x5, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x1, 0x63, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x5, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"a", "b", "c"}, + Output: []string{"y"}, + Name: "", + OpType: "Gemm", + Attributes: ([]*ir.AttributeProto) (len=4 cap=4) { + (*ir.AttributeProto)(0xc000216d00)(name:"alpha" type:FLOAT f:0.25 ), + (*ir.AttributeProto)(0xc000216e00)(name:"beta" type:FLOAT f:0.35 ), + (*ir.AttributeProto)(0xc000216f00)(name:"transA" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217000)(name:"transB" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(4, 3), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949}), + ), + + tensor.New( + tensor.WithShape(5, 4), + tensor.WithBacking([]float32{0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337}), + ), + + tensor.New( + tensor.WithShape(1, 5), + tensor.WithBacking([]float32{0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 5), + tensor.WithBacking([]float32{0.37979913, 0.4836736, 0.37501436, 0.42580932, 0.44547832, 0.39233345, 0.63644016, 0.52356744, 0.5240351, 0.5636829, 0.42334533, 0.63895106, 0.49747032, 0.49676925, 0.5259358}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_all_attributes_test.go b/backend/testbackend/onnx/onnx_test_gemm_all_attributes_test.go new file mode 100644 index 00000000..648c41f1 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_all_attributes_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestGemmAllAttributes(t *testing.T) { + mytest := NewTestGemmAllAttributes() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_alpha.go b/backend/testbackend/onnx/onnx_test_gemm_alpha.go new file mode 100644 index 00000000..0cb91e3f --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_alpha.go @@ -0,0 +1,215 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Gemm", "TestGemmAlpha", NewTestGemmAlpha) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a", "b", "c"}, + Output: {"y"}, + Name: "", + OpType: "Gemm", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "alpha", + RefAttrName: "", + DocString: "", + Type: 1, + F: 0.5, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_gemm_alpha", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "c", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestGemmAlpha version: 6. +func NewTestGemmAlpha() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Gemm", + Title: "TestGemmAlpha", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x8a, 0x1, 0xa, 0x23, 0xa, 0x1, 0x61, 0xa, 0x1, 0x62, 0xa, 0x1, 0x63, 0x12, 0x1, 0x79, 0x22, 0x4, 0x47, 0x65, 0x6d, 0x6d, 0x2a, 0xf, 0xa, 0x5, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x15, 0x0, 0x0, 0x0, 0x3f, 0xa0, 0x1, 0x1, 0x12, 0xf, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x65, 0x6d, 0x6d, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x5a, 0x13, 0xa, 0x1, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x5, 0x5a, 0x13, 0xa, 0x1, 0x62, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x5, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x1, 0x63, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x4, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"a", "b", "c"}, + Output: []string{"y"}, + Name: "", + OpType: "Gemm", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217600)(name:"alpha" type:FLOAT f:0.5 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 5), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056}), + ), + + tensor.New( + tensor.WithShape(5, 4), + tensor.WithBacking([]float32{0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898}), + ), + + tensor.New( + tensor.WithShape(1, 4), + tensor.WithBacking([]float32{0, 0, 0, 0}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4), + tensor.WithBacking([]float32{0.99162877, 0.62994087, 0.9404929, 0.49781424, 1.1701264, 0.6122782, 1.0378528, 0.54726505, 0.95094186, 0.5581015, 0.93478477, 0.59389895}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_alpha_test.go b/backend/testbackend/onnx/onnx_test_gemm_alpha_test.go new file mode 100644 index 00000000..992b7a23 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_alpha_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestGemmAlpha(t *testing.T) { + mytest := NewTestGemmAlpha() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_beta.go b/backend/testbackend/onnx/onnx_test_gemm_beta.go new file mode 100644 index 00000000..1a0d1358 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_beta.go @@ -0,0 +1,215 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Gemm", "TestGemmBeta", NewTestGemmBeta) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a", "b", "c"}, + Output: {"y"}, + Name: "", + OpType: "Gemm", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "beta", + RefAttrName: "", + DocString: "", + Type: 1, + F: 0.5, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_gemm_beta", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "c", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestGemmBeta version: 6. +func NewTestGemmBeta() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Gemm", + Title: "TestGemmBeta", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x88, 0x1, 0xa, 0x22, 0xa, 0x1, 0x61, 0xa, 0x1, 0x62, 0xa, 0x1, 0x63, 0x12, 0x1, 0x79, 0x22, 0x4, 0x47, 0x65, 0x6d, 0x6d, 0x2a, 0xe, 0xa, 0x4, 0x62, 0x65, 0x74, 0x61, 0x15, 0x0, 0x0, 0x0, 0x3f, 0xa0, 0x1, 0x1, 0x12, 0xe, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x65, 0x6d, 0x6d, 0x5f, 0x62, 0x65, 0x74, 0x61, 0x5a, 0x13, 0xa, 0x1, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x7, 0x5a, 0x13, 0xa, 0x1, 0x62, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x7, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x1, 0x63, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x4, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"a", "b", "c"}, + Output: []string{"y"}, + Name: "", + OpType: "Gemm", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217c00)(name:"beta" type:FLOAT f:0.5 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 7), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665}), + ), + + tensor.New( + tensor.WithShape(7, 4), + tensor.WithBacking([]float32{0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195}), + ), + + tensor.New( + tensor.WithShape(1, 4), + tensor.WithBacking([]float32{0.6976312, 0.06022547, 0.6667667, 0.67063785}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 4), + tensor.WithBacking([]float32{1.8377928, 2.7106533, 2.1459303, 2.8060184, 2.4766169, 3.3848393, 2.6746957, 3.4772196}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_beta_test.go b/backend/testbackend/onnx/onnx_test_gemm_beta_test.go new file mode 100644 index 00000000..6c327937 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_beta_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestGemmBeta(t *testing.T) { + mytest := NewTestGemmBeta() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_broadcast.go b/backend/testbackend/onnx/onnx_test_gemm_broadcast.go deleted file mode 100644 index 9e1ae379..00000000 --- a/backend/testbackend/onnx/onnx_test_gemm_broadcast.go +++ /dev/null @@ -1,65 +0,0 @@ -package onnxtest - -// this file is auto-generated... DO NOT EDIT - -import ( - "github.com/owulveryck/onnx-go/backend/testbackend" - "gorgonia.org/tensor" -) - -func init() { - testbackend.Register("Gemm", "TestGemmBroadcast", NewTestGemmBroadcast) -} - -// NewTestGemmBroadcast version: 3. -func NewTestGemmBroadcast() *testbackend.TestCase { - return &testbackend.TestCase{ - OpType: "Gemm", - Title: "TestGemmBroadcast", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xbc, 0x1, 0xa, 0x51, 0xa, 0x1, 0x61, 0xa, 0x1, 0x62, 0xa, 0x1, 0x63, 0x12, 0x1, 0x79, 0x22, 0x4, 0x47, 0x65, 0x6d, 0x6d, 0x2a, 0xf, 0xa, 0x5, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x15, 0x0, 0x0, 0x0, 0x3f, 0xa0, 0x1, 0x1, 0x2a, 0xe, 0xa, 0x4, 0x62, 0x65, 0x74, 0x61, 0x15, 0x0, 0x0, 0x0, 0x3f, 0xa0, 0x1, 0x1, 0x2a, 0xd, 0xa, 0x6, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x41, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xd, 0xa, 0x6, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x42, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x13, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x65, 0x6d, 0x6d, 0x5f, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x5a, 0x13, 0xa, 0x1, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x13, 0xa, 0x1, 0x62, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x6, 0x5a, 0x13, 0xa, 0x1, 0x63, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0x9}, - - /* - - &ir.NodeProto{ - Input: []string{"a", "b", "c"}, - Output: []string{"y"}, - Name: "", - OpType: "Gemm", - Attributes: ([]*ir.AttributeProto) (len=4 cap=4) { - (*ir.AttributeProto)(0xc000118b00)(name:"alpha" type:FLOAT f:0.5 ), - (*ir.AttributeProto)(0xc000118c00)(name:"beta" type:FLOAT f:0.5 ), - (*ir.AttributeProto)(0xc000118d00)(name:"transA" type:INT i:1 ), - (*ir.AttributeProto)(0xc000118e00)(name:"transB" type:INT i:1 ) - } - , - }, - - - */ - - Input: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(6, 3), - tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985}), - ), - - tensor.New( - tensor.WithShape(4, 6), - tensor.WithBacking([]float32{0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195}), - ), - - tensor.New( - tensor.WithShape(1, 1), - tensor.WithBacking([]float32{0.6976312}), - ), - }, - ExpectedOutput: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(3, 4), - tensor.WithBacking([]float32{1.3317792, 0.9343705, 0.8733721, 1.1432098, 1.7855448, 1.2102433, 1.0507759, 1.5598905, 1.8885028, 1.1011722, 1.3064879, 1.5622698}), - ), - }, - } -} diff --git a/backend/testbackend/onnx/onnx_test_gemm_default_matrix_bias.go b/backend/testbackend/onnx/onnx_test_gemm_default_matrix_bias.go new file mode 100644 index 00000000..bdc3267a --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_default_matrix_bias.go @@ -0,0 +1,194 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Gemm", "TestGemmDefaultMatrixBias", NewTestGemmDefaultMatrixBias) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a", "b", "c"}, + Output: {"y"}, + Name: "", + OpType: "Gemm", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_gemm_default_matrix_bias", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "c", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestGemmDefaultMatrixBias version: 6. +func NewTestGemmDefaultMatrixBias() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Gemm", + Title: "TestGemmDefaultMatrixBias", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x87, 0x1, 0xa, 0x12, 0xa, 0x1, 0x61, 0xa, 0x1, 0x62, 0xa, 0x1, 0x63, 0x12, 0x1, 0x79, 0x22, 0x4, 0x47, 0x65, 0x6d, 0x6d, 0x12, 0x1d, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x65, 0x6d, 0x6d, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x72, 0x69, 0x78, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x5a, 0x13, 0xa, 0x1, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x6, 0x5a, 0x13, 0xa, 0x1, 0x62, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x1, 0x63, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"a", "b", "c"}, + Output: []string{"y"}, + Name: "", + OpType: "Gemm", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 6), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985}), + ), + + tensor.New( + tensor.WithShape(6, 4), + tensor.WithBacking([]float32{0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195}), + ), + + tensor.New( + tensor.WithShape(3, 4), + tensor.WithBacking([]float32{0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4), + tensor.WithBacking([]float32{2.302821, 2.7892525, 2.3430552, 2.670208, 1.7160345, 3.2625115, 2.2016792, 2.6212182, 2.2587652, 2.370011, 2.0422702, 1.6036494}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_default_matrix_bias_test.go b/backend/testbackend/onnx/onnx_test_gemm_default_matrix_bias_test.go new file mode 100644 index 00000000..1792cf0f --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_default_matrix_bias_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestGemmDefaultMatrixBias(t *testing.T) { + mytest := NewTestGemmDefaultMatrixBias() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_default_no_bias.go b/backend/testbackend/onnx/onnx_test_gemm_default_no_bias.go new file mode 100644 index 00000000..f32819ab --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_default_no_bias.go @@ -0,0 +1,165 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Gemm", "TestGemmDefaultNoBias", NewTestGemmDefaultNoBias) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a", "b"}, + Output: {"y"}, + Name: "", + OpType: "Gemm", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_gemm_default_no_bias", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestGemmDefaultNoBias version: 6. +func NewTestGemmDefaultNoBias() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Gemm", + Title: "TestGemmDefaultNoBias", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x6b, 0xa, 0xf, 0xa, 0x1, 0x61, 0xa, 0x1, 0x62, 0x12, 0x1, 0x79, 0x22, 0x4, 0x47, 0x65, 0x6d, 0x6d, 0x12, 0x19, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x65, 0x6d, 0x6d, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x6e, 0x6f, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x5a, 0x13, 0xa, 0x1, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0xa, 0x5a, 0x13, 0xa, 0x1, 0x62, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0xa, 0xa, 0x2, 0x8, 0x3, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"a", "b"}, + Output: []string{"y"}, + Name: "", + OpType: "Gemm", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 10), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216}), + ), + + tensor.New( + tensor.WithShape(10, 3), + tensor.WithBacking([]float32{0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3), + tensor.WithBacking([]float32{3.4945123, 3.5606117, 2.4070063, 2.7530518, 2.9613998, 2.3095217}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_default_no_bias_test.go b/backend/testbackend/onnx/onnx_test_gemm_default_no_bias_test.go new file mode 100644 index 00000000..1231417a --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_default_no_bias_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestGemmDefaultNoBias(t *testing.T) { + mytest := NewTestGemmDefaultNoBias() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_default_scalar_bias.go b/backend/testbackend/onnx/onnx_test_gemm_default_scalar_bias.go new file mode 100644 index 00000000..a4cfe369 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_default_scalar_bias.go @@ -0,0 +1,183 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Gemm", "TestGemmDefaultScalarBias", NewTestGemmDefaultScalarBias) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a", "b", "c"}, + Output: {"y"}, + Name: "", + OpType: "Gemm", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_gemm_default_scalar_bias", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "c", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestGemmDefaultScalarBias version: 6. +func NewTestGemmDefaultScalarBias() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Gemm", + Title: "TestGemmDefaultScalarBias", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x7f, 0xa, 0x12, 0xa, 0x1, 0x61, 0xa, 0x1, 0x62, 0xa, 0x1, 0x63, 0x12, 0x1, 0x79, 0x22, 0x4, 0x47, 0x65, 0x6d, 0x6d, 0x12, 0x1d, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x65, 0x6d, 0x6d, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x5a, 0x13, 0xa, 0x1, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x13, 0xa, 0x1, 0x62, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0xb, 0xa, 0x1, 0x63, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"a", "b", "c"}, + Output: []string{"y"}, + Name: "", + OpType: "Gemm", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941}), + ), + + tensor.New( + tensor.WithShape(3, 4), + tensor.WithBacking([]float32{0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{3.14}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 4), + tensor.WithBacking([]float32{3.9892051, 4.0601954, 4.0873175, 4.5142875, 3.759734, 3.9062574, 3.9187975, 4.2788486}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_default_scalar_bias_test.go b/backend/testbackend/onnx/onnx_test_gemm_default_scalar_bias_test.go new file mode 100644 index 00000000..073c2840 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_default_scalar_bias_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestGemmDefaultScalarBias(t *testing.T) { + mytest := NewTestGemmDefaultScalarBias() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_default_single_elem_vector_bias.go b/backend/testbackend/onnx/onnx_test_gemm_default_single_elem_vector_bias.go new file mode 100644 index 00000000..cb36cbae --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_default_single_elem_vector_bias.go @@ -0,0 +1,190 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Gemm", "TestGemmDefaultSingleElemVectorBias", NewTestGemmDefaultSingleElemVectorBias) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a", "b", "c"}, + Output: {"y"}, + Name: "", + OpType: "Gemm", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_gemm_default_single_elem_vector_bias", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "c", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestGemmDefaultSingleElemVectorBias version: 6. +func NewTestGemmDefaultSingleElemVectorBias() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Gemm", + Title: "TestGemmDefaultSingleElemVectorBias", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x8f, 0x1, 0xa, 0x12, 0xa, 0x1, 0x61, 0xa, 0x1, 0x62, 0xa, 0x1, 0x63, 0x12, 0x1, 0x79, 0x22, 0x4, 0x47, 0x65, 0x6d, 0x6d, 0x12, 0x29, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x65, 0x6d, 0x6d, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x5f, 0x65, 0x6c, 0x65, 0x6d, 0x5f, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x5a, 0x13, 0xa, 0x1, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x7, 0x5a, 0x13, 0xa, 0x1, 0x62, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x7, 0xa, 0x2, 0x8, 0x3, 0x5a, 0xf, 0xa, 0x1, 0x63, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"a", "b", "c"}, + Output: []string{"y"}, + Name: "", + OpType: "Gemm", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 7), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183}), + ), + + tensor.New( + tensor.WithShape(7, 3), + tensor.WithBacking([]float32{0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{0.6976312}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 3), + tensor.WithBacking([]float32{2.8688972, 2.7087305, 2.7894776, 3.3753865, 3.232056, 3.3192449, 2.6461825, 2.3445446, 2.8831277}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_default_single_elem_vector_bias_test.go b/backend/testbackend/onnx/onnx_test_gemm_default_single_elem_vector_bias_test.go new file mode 100644 index 00000000..d8593806 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_default_single_elem_vector_bias_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestGemmDefaultSingleElemVectorBias(t *testing.T) { + mytest := NewTestGemmDefaultSingleElemVectorBias() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_default_vector_bias.go b/backend/testbackend/onnx/onnx_test_gemm_default_vector_bias.go new file mode 100644 index 00000000..d0120e58 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_default_vector_bias.go @@ -0,0 +1,194 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Gemm", "TestGemmDefaultVectorBias", NewTestGemmDefaultVectorBias) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a", "b", "c"}, + Output: {"y"}, + Name: "", + OpType: "Gemm", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_gemm_default_vector_bias", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "c", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestGemmDefaultVectorBias version: 6. +func NewTestGemmDefaultVectorBias() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Gemm", + Title: "TestGemmDefaultVectorBias", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x87, 0x1, 0xa, 0x12, 0xa, 0x1, 0x61, 0xa, 0x1, 0x62, 0xa, 0x1, 0x63, 0x12, 0x1, 0x79, 0x22, 0x4, 0x47, 0x65, 0x6d, 0x6d, 0x12, 0x1d, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x65, 0x6d, 0x6d, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x5a, 0x13, 0xa, 0x1, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x7, 0x5a, 0x13, 0xa, 0x1, 0x62, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x7, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x1, 0x63, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x4, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"a", "b", "c"}, + Output: []string{"y"}, + Name: "", + OpType: "Gemm", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 7), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665}), + ), + + tensor.New( + tensor.WithShape(7, 4), + tensor.WithBacking([]float32{0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195}), + ), + + tensor.New( + tensor.WithShape(1, 4), + tensor.WithBacking([]float32{0.6976312, 0.06022547, 0.6667667, 0.67063785}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 4), + tensor.WithBacking([]float32{2.1866083, 2.740766, 2.4793136, 3.1413374, 2.8254323, 3.414952, 3.008079, 3.8125386}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_default_vector_bias_test.go b/backend/testbackend/onnx/onnx_test_gemm_default_vector_bias_test.go new file mode 100644 index 00000000..7ddc73e4 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_default_vector_bias_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestGemmDefaultVectorBias(t *testing.T) { + mytest := NewTestGemmDefaultVectorBias() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_default_zero_bias.go b/backend/testbackend/onnx/onnx_test_gemm_default_zero_bias.go new file mode 100644 index 00000000..0db120ff --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_default_zero_bias.go @@ -0,0 +1,194 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Gemm", "TestGemmDefaultZeroBias", NewTestGemmDefaultZeroBias) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a", "b", "c"}, + Output: {"y"}, + Name: "", + OpType: "Gemm", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_gemm_default_zero_bias", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "c", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestGemmDefaultZeroBias version: 6. +func NewTestGemmDefaultZeroBias() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Gemm", + Title: "TestGemmDefaultZeroBias", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x85, 0x1, 0xa, 0x12, 0xa, 0x1, 0x61, 0xa, 0x1, 0x62, 0xa, 0x1, 0x63, 0x12, 0x1, 0x79, 0x22, 0x4, 0x47, 0x65, 0x6d, 0x6d, 0x12, 0x1b, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x65, 0x6d, 0x6d, 0x5f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x7a, 0x65, 0x72, 0x6f, 0x5f, 0x62, 0x69, 0x61, 0x73, 0x5a, 0x13, 0xa, 0x1, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x5, 0x5a, 0x13, 0xa, 0x1, 0x62, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x5, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x1, 0x63, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x4, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"a", "b", "c"}, + Output: []string{"y"}, + Name: "", + OpType: "Gemm", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 5), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056}), + ), + + tensor.New( + tensor.WithShape(5, 4), + tensor.WithBacking([]float32{0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898}), + ), + + tensor.New( + tensor.WithShape(1, 4), + tensor.WithBacking([]float32{0, 0, 0, 0}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4), + tensor.WithBacking([]float32{1.9832575, 1.2598817, 1.8809859, 0.9956285, 2.3402529, 1.2245564, 2.0757055, 1.0945301, 1.9018837, 1.116203, 1.8695695, 1.1877979}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_default_zero_bias_test.go b/backend/testbackend/onnx/onnx_test_gemm_default_zero_bias_test.go new file mode 100644 index 00000000..90eee908 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_default_zero_bias_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestGemmDefaultZeroBias(t *testing.T) { + mytest := NewTestGemmDefaultZeroBias() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_nobroadcast.go b/backend/testbackend/onnx/onnx_test_gemm_nobroadcast.go deleted file mode 100644 index 7e9f4c46..00000000 --- a/backend/testbackend/onnx/onnx_test_gemm_nobroadcast.go +++ /dev/null @@ -1,63 +0,0 @@ -package onnxtest - -// this file is auto-generated... DO NOT EDIT - -import ( - "github.com/owulveryck/onnx-go/backend/testbackend" - "gorgonia.org/tensor" -) - -func init() { - testbackend.Register("Gemm", "TestGemmNobroadcast", NewTestGemmNobroadcast) -} - -// NewTestGemmNobroadcast version: 3. -func NewTestGemmNobroadcast() *testbackend.TestCase { - return &testbackend.TestCase{ - OpType: "Gemm", - Title: "TestGemmNobroadcast", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xa0, 0x1, 0xa, 0x33, 0xa, 0x1, 0x61, 0xa, 0x1, 0x62, 0xa, 0x1, 0x63, 0x12, 0x1, 0x79, 0x22, 0x4, 0x47, 0x65, 0x6d, 0x6d, 0x2a, 0xf, 0xa, 0x5, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x15, 0x0, 0x0, 0x0, 0x3f, 0xa0, 0x1, 0x1, 0x2a, 0xe, 0xa, 0x4, 0x62, 0x65, 0x74, 0x61, 0x15, 0x0, 0x0, 0x0, 0x3f, 0xa0, 0x1, 0x1, 0x12, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x65, 0x6d, 0x6d, 0x5f, 0x6e, 0x6f, 0x62, 0x72, 0x6f, 0x61, 0x64, 0x63, 0x61, 0x73, 0x74, 0x5a, 0x13, 0xa, 0x1, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x6, 0x5a, 0x13, 0xa, 0x1, 0x62, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x1, 0x63, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0x9}, - - /* - - &ir.NodeProto{ - Input: []string{"a", "b", "c"}, - Output: []string{"y"}, - Name: "", - OpType: "Gemm", - Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132a00)(name:"alpha" type:FLOAT f:0.5 ), - (*ir.AttributeProto)(0xc000132b00)(name:"beta" type:FLOAT f:0.5 ) - } - , - }, - - - */ - - Input: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(3, 6), - tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985}), - ), - - tensor.New( - tensor.WithShape(6, 4), - tensor.WithBacking([]float32{0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195}), - ), - - tensor.New( - tensor.WithShape(3, 4), - tensor.WithBacking([]float32{0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481}), - ), - }, - ExpectedOutput: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(3, 4), - tensor.WithBacking([]float32{1.1514105, 1.3946263, 1.1715276, 1.335104, 0.85801727, 1.6312557, 1.1008396, 1.3106091, 1.1293826, 1.1850055, 1.0211351, 0.8018247}), - ), - }, - } -} diff --git a/backend/testbackend/onnx/onnx_test_gemm_transposeA.go b/backend/testbackend/onnx/onnx_test_gemm_transposeA.go new file mode 100644 index 00000000..2c9b32f0 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_transposeA.go @@ -0,0 +1,215 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Gemm", "TestGemmTransposeA", NewTestGemmTransposeA) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a", "b", "c"}, + Output: {"y"}, + Name: "", + OpType: "Gemm", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "transA", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_gemm_transposeA", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "c", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestGemmTransposeA version: 6. +func NewTestGemmTransposeA() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Gemm", + Title: "TestGemmTransposeA", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x8d, 0x1, 0xa, 0x21, 0xa, 0x1, 0x61, 0xa, 0x1, 0x62, 0xa, 0x1, 0x63, 0x12, 0x1, 0x79, 0x22, 0x4, 0x47, 0x65, 0x6d, 0x6d, 0x2a, 0xd, 0xa, 0x6, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x41, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x14, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x65, 0x6d, 0x6d, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x73, 0x65, 0x41, 0x5a, 0x13, 0xa, 0x1, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x13, 0xa, 0x1, 0x62, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x1, 0x63, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x4, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"a", "b", "c"}, + Output: []string{"y"}, + Name: "", + OpType: "Gemm", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0004a1400)(name:"transA" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(6, 3), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985}), + ), + + tensor.New( + tensor.WithShape(6, 4), + tensor.WithBacking([]float32{0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195}), + ), + + tensor.New( + tensor.WithShape(1, 4), + tensor.WithBacking([]float32{0, 0, 0, 0}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4), + tensor.WithBacking([]float32{0.93558806, 2.023271, 1.3838071, 1.5752075, 1.1258042, 2.9937754, 2.1503432, 2.2423513, 1.8322957, 2.9599526, 1.7532237, 2.002967}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_clip_default_max_test.go b/backend/testbackend/onnx/onnx_test_gemm_transposeA_test.go similarity index 88% rename from backend/testbackend/onnx/onnx_test_clip_default_max_test.go rename to backend/testbackend/onnx/onnx_test_gemm_transposeA_test.go index 939a4d83..266768c3 100644 --- a/backend/testbackend/onnx/onnx_test_clip_default_max_test.go +++ b/backend/testbackend/onnx/onnx_test_gemm_transposeA_test.go @@ -7,8 +7,8 @@ import ( "github.com/owulveryck/onnx-go/internal/onnx/ir" ) -func TestNewTestClipDefaultMax(t *testing.T) { - mytest := NewTestClipDefaultMax() +func TestNewTestGemmTransposeA(t *testing.T) { + mytest := NewTestGemmTransposeA() var model ir.ModelProto err := proto.Unmarshal(mytest.ModelB, &model) if err != nil { diff --git a/backend/testbackend/onnx/onnx_test_gemm_transposeB.go b/backend/testbackend/onnx/onnx_test_gemm_transposeB.go new file mode 100644 index 00000000..b7efdf15 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_transposeB.go @@ -0,0 +1,215 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Gemm", "TestGemmTransposeB", NewTestGemmTransposeB) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a", "b", "c"}, + Output: {"y"}, + Name: "", + OpType: "Gemm", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "transB", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_gemm_transposeB", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "c", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestGemmTransposeB version: 6. +func NewTestGemmTransposeB() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Gemm", + Title: "TestGemmTransposeB", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x8d, 0x1, 0xa, 0x21, 0xa, 0x1, 0x61, 0xa, 0x1, 0x62, 0xa, 0x1, 0x63, 0x12, 0x1, 0x79, 0x22, 0x4, 0x47, 0x65, 0x6d, 0x6d, 0x2a, 0xd, 0xa, 0x6, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x42, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x14, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x67, 0x65, 0x6d, 0x6d, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x73, 0x65, 0x42, 0x5a, 0x13, 0xa, 0x1, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x6, 0x5a, 0x13, 0xa, 0x1, 0x62, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x6, 0x5a, 0x13, 0xa, 0x1, 0x63, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x4, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"a", "b", "c"}, + Output: []string{"y"}, + Name: "", + OpType: "Gemm", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000216b00)(name:"transB" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 6), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985}), + ), + + tensor.New( + tensor.WithShape(4, 6), + tensor.WithBacking([]float32{0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195}), + ), + + tensor.New( + tensor.WithShape(1, 4), + tensor.WithBacking([]float32{0, 0, 0, 0}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4), + tensor.WithBacking([]float32{2.774257, 1.6126288, 1.6904837, 2.152104, 3.1440363, 1.755262, 1.8052837, 2.5046787, 2.0456698, 1.1077921, 1.4634733, 1.4163265}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_gemm_transposeB_test.go b/backend/testbackend/onnx/onnx_test_gemm_transposeB_test.go new file mode 100644 index 00000000..e0180e39 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_gemm_transposeB_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestGemmTransposeB(t *testing.T) { + mytest := NewTestGemmTransposeB() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_globalaveragepool.go b/backend/testbackend/onnx/onnx_test_globalaveragepool.go index ac0d1c2e..eb91ea98 100644 --- a/backend/testbackend/onnx/onnx_test_globalaveragepool.go +++ b/backend/testbackend/onnx/onnx_test_globalaveragepool.go @@ -11,6 +11,108 @@ func init() { testbackend.Register("GlobalAveragePool", "TestGlobalaveragepool", NewTestGlobalaveragepool) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "GlobalAveragePool", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_globalaveragepool", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestGlobalaveragepool version: 3. func NewTestGlobalaveragepool() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_globalaveragepool_precomputed.go b/backend/testbackend/onnx/onnx_test_globalaveragepool_precomputed.go index 02122fae..98e8f9c6 100644 --- a/backend/testbackend/onnx/onnx_test_globalaveragepool_precomputed.go +++ b/backend/testbackend/onnx/onnx_test_globalaveragepool_precomputed.go @@ -11,6 +11,108 @@ func init() { testbackend.Register("GlobalAveragePool", "TestGlobalaveragepoolPrecomputed", NewTestGlobalaveragepoolPrecomputed) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "GlobalAveragePool", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_globalaveragepool_precomputed", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestGlobalaveragepoolPrecomputed version: 3. func NewTestGlobalaveragepoolPrecomputed() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_globalmaxpool.go b/backend/testbackend/onnx/onnx_test_globalmaxpool.go index 74746a08..18ed6859 100644 --- a/backend/testbackend/onnx/onnx_test_globalmaxpool.go +++ b/backend/testbackend/onnx/onnx_test_globalmaxpool.go @@ -11,6 +11,108 @@ func init() { testbackend.Register("GlobalMaxPool", "TestGlobalmaxpool", NewTestGlobalmaxpool) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "GlobalMaxPool", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_globalmaxpool", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestGlobalmaxpool version: 3. func NewTestGlobalmaxpool() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_globalmaxpool_precomputed.go b/backend/testbackend/onnx/onnx_test_globalmaxpool_precomputed.go index 1a22ffbc..ab05f94e 100644 --- a/backend/testbackend/onnx/onnx_test_globalmaxpool_precomputed.go +++ b/backend/testbackend/onnx/onnx_test_globalmaxpool_precomputed.go @@ -11,6 +11,108 @@ func init() { testbackend.Register("GlobalMaxPool", "TestGlobalmaxpoolPrecomputed", NewTestGlobalmaxpoolPrecomputed) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "GlobalMaxPool", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_globalmaxpool_precomputed", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestGlobalmaxpoolPrecomputed version: 3. func NewTestGlobalmaxpoolPrecomputed() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_hardmax_axis_0.go b/backend/testbackend/onnx/onnx_test_hardmax_axis_0.go index c902130d..44b47696 100644 --- a/backend/testbackend/onnx/onnx_test_hardmax_axis_0.go +++ b/backend/testbackend/onnx/onnx_test_hardmax_axis_0.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("Hardmax", "TestHardmaxAxis0", NewTestHardmaxAxis0) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Hardmax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_hardmax_axis_0", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestHardmaxAxis0 version: 3. func NewTestHardmaxAxis0() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestHardmaxAxis0() *testbackend.TestCase { Name: "", OpType: "Hardmax", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126100)(name:"axis" type:INT ) + (*ir.AttributeProto)(0xc0001e6400)(name:"axis" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_hardmax_axis_1.go b/backend/testbackend/onnx/onnx_test_hardmax_axis_1.go index 1ab62ba7..5311494c 100644 --- a/backend/testbackend/onnx/onnx_test_hardmax_axis_1.go +++ b/backend/testbackend/onnx/onnx_test_hardmax_axis_1.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("Hardmax", "TestHardmaxAxis1", NewTestHardmaxAxis1) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Hardmax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_hardmax_axis_1", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestHardmaxAxis1 version: 3. func NewTestHardmaxAxis1() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestHardmaxAxis1() *testbackend.TestCase { Name: "", OpType: "Hardmax", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000133b00)(name:"axis" type:INT i:1 ) + (*ir.AttributeProto)(0xc000216b00)(name:"axis" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_hardmax_axis_2.go b/backend/testbackend/onnx/onnx_test_hardmax_axis_2.go index 47f5cd83..9c51924f 100644 --- a/backend/testbackend/onnx/onnx_test_hardmax_axis_2.go +++ b/backend/testbackend/onnx/onnx_test_hardmax_axis_2.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("Hardmax", "TestHardmaxAxis2", NewTestHardmaxAxis2) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Hardmax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_hardmax_axis_2", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestHardmaxAxis2 version: 3. func NewTestHardmaxAxis2() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestHardmaxAxis2() *testbackend.TestCase { Name: "", OpType: "Hardmax", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc00023a400)(name:"axis" type:INT i:2 ) + (*ir.AttributeProto)(0xc000530300)(name:"axis" type:INT i:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_hardmax_default_axis.go b/backend/testbackend/onnx/onnx_test_hardmax_default_axis.go index da4f0ab4..c92a9a67 100644 --- a/backend/testbackend/onnx/onnx_test_hardmax_default_axis.go +++ b/backend/testbackend/onnx/onnx_test_hardmax_default_axis.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Hardmax", "TestHardmaxDefaultAxis", NewTestHardmaxDefaultAxis) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Hardmax", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_hardmax_default_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestHardmaxDefaultAxis version: 3. func NewTestHardmaxDefaultAxis() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_hardmax_example.go b/backend/testbackend/onnx/onnx_test_hardmax_example.go index 794736b4..440d05c4 100644 --- a/backend/testbackend/onnx/onnx_test_hardmax_example.go +++ b/backend/testbackend/onnx/onnx_test_hardmax_example.go @@ -11,6 +11,92 @@ func init() { testbackend.Register("Hardmax", "TestHardmaxExample", NewTestHardmaxExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Hardmax", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_hardmax_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestHardmaxExample version: 3. func NewTestHardmaxExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_hardmax_negative_axis.go b/backend/testbackend/onnx/onnx_test_hardmax_negative_axis.go new file mode 100644 index 00000000..af6949fd --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_hardmax_negative_axis.go @@ -0,0 +1,165 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Hardmax", "TestHardmaxNegativeAxis", NewTestHardmaxNegativeAxis) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Hardmax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_hardmax_negative_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestHardmaxNegativeAxis version: 6. +func NewTestHardmaxNegativeAxis() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Hardmax", + Title: "TestHardmaxNegativeAxis", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x75, 0xa, 0x25, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x7, 0x48, 0x61, 0x72, 0x64, 0x6d, 0x61, 0x78, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1a, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x68, 0x61, 0x72, 0x64, 0x6d, 0x61, 0x78, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Hardmax", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000530d00)(name:"axis" type:INT i:-1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 5), + tensor.WithBacking([]float32{0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_hardmax_negative_axis_test.go b/backend/testbackend/onnx/onnx_test_hardmax_negative_axis_test.go new file mode 100644 index 00000000..d8503295 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_hardmax_negative_axis_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestHardmaxNegativeAxis(t *testing.T) { + mytest := NewTestHardmaxNegativeAxis() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_hardmax_one_hot.go b/backend/testbackend/onnx/onnx_test_hardmax_one_hot.go index 589334ef..9e9ee492 100644 --- a/backend/testbackend/onnx/onnx_test_hardmax_one_hot.go +++ b/backend/testbackend/onnx/onnx_test_hardmax_one_hot.go @@ -11,6 +11,92 @@ func init() { testbackend.Register("Hardmax", "TestHardmaxOneHot", NewTestHardmaxOneHot) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Hardmax", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_hardmax_one_hot", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestHardmaxOneHot version: 3. func NewTestHardmaxOneHot() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_hardsigmoid.go b/backend/testbackend/onnx/onnx_test_hardsigmoid.go index f290717a..5628c7b2 100644 --- a/backend/testbackend/onnx/onnx_test_hardsigmoid.go +++ b/backend/testbackend/onnx/onnx_test_hardsigmoid.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("HardSigmoid", "TestHardsigmoid", NewTestHardsigmoid) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "HardSigmoid", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "alpha", + RefAttrName: "", + DocString: "", + Type: 1, + F: 0.5, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "beta", + RefAttrName: "", + DocString: "", + Type: 1, + F: 0.6000000238418579, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_hardsigmoid", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestHardsigmoid version: 3. func NewTestHardsigmoid() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestHardsigmoid() *testbackend.TestCase { Name: "", OpType: "HardSigmoid", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000127000)(name:"alpha" type:FLOAT f:0.5 ), - (*ir.AttributeProto)(0xc000127100)(name:"beta" type:FLOAT f:0.6 ) + (*ir.AttributeProto)(0xc0001e6400)(name:"alpha" type:FLOAT f:0.5 ), + (*ir.AttributeProto)(0xc0001e6500)(name:"beta" type:FLOAT f:0.6 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_hardsigmoid_default.go b/backend/testbackend/onnx/onnx_test_hardsigmoid_default.go index 95b6024d..75d776ae 100644 --- a/backend/testbackend/onnx/onnx_test_hardsigmoid_default.go +++ b/backend/testbackend/onnx/onnx_test_hardsigmoid_default.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("HardSigmoid", "TestHardsigmoidDefault", NewTestHardsigmoidDefault) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "HardSigmoid", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_hardsigmoid_default", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestHardsigmoidDefault version: 3. func NewTestHardsigmoidDefault() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_hardsigmoid_example.go b/backend/testbackend/onnx/onnx_test_hardsigmoid_example.go index 2c819cf4..b7f400f1 100644 --- a/backend/testbackend/onnx/onnx_test_hardsigmoid_example.go +++ b/backend/testbackend/onnx/onnx_test_hardsigmoid_example.go @@ -11,6 +11,121 @@ func init() { testbackend.Register("HardSigmoid", "TestHardsigmoidExample", NewTestHardsigmoidExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "HardSigmoid", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "alpha", + RefAttrName: "", + DocString: "", + Type: 1, + F: 0.5, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "beta", + RefAttrName: "", + DocString: "", + Type: 1, + F: 0.6000000238418579, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_hardsigmoid_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestHardsigmoidExample version: 3. func NewTestHardsigmoidExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +141,8 @@ func NewTestHardsigmoidExample() *testbackend.TestCase { Name: "", OpType: "HardSigmoid", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc00023aa00)(name:"alpha" type:FLOAT f:0.5 ), - (*ir.AttributeProto)(0xc00023ab00)(name:"beta" type:FLOAT f:0.6 ) + (*ir.AttributeProto)(0xc000217000)(name:"alpha" type:FLOAT f:0.5 ), + (*ir.AttributeProto)(0xc000217100)(name:"beta" type:FLOAT f:0.6 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_identity.go b/backend/testbackend/onnx/onnx_test_identity.go index d51afd24..0e3aac59 100644 --- a/backend/testbackend/onnx/onnx_test_identity.go +++ b/backend/testbackend/onnx/onnx_test_identity.go @@ -11,6 +11,108 @@ func init() { testbackend.Register("Identity", "TestIdentity", NewTestIdentity) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Identity", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_identity", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestIdentity version: 3. func NewTestIdentity() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_instancenorm_epsilon.go b/backend/testbackend/onnx/onnx_test_instancenorm_epsilon.go index 76c08373..8d45732f 100644 --- a/backend/testbackend/onnx/onnx_test_instancenorm_epsilon.go +++ b/backend/testbackend/onnx/onnx_test_instancenorm_epsilon.go @@ -11,6 +11,167 @@ func init() { testbackend.Register("InstanceNormalization", "TestInstancenormEpsilon", NewTestInstancenormEpsilon) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "s", "bias"}, + Output: {"y"}, + Name: "", + OpType: "InstanceNormalization", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "epsilon", + RefAttrName: "", + DocString: "", + Type: 1, + F: 0.009999999776482582, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_instancenorm_epsilon", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "s", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "bias", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestInstancenormEpsilon version: 3. func NewTestInstancenormEpsilon() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +187,7 @@ func NewTestInstancenormEpsilon() *testbackend.TestCase { Name: "", OpType: "InstanceNormalization", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc0004ce000)(name:"epsilon" type:FLOAT f:0.01 ) + (*ir.AttributeProto)(0xc000217500)(name:"epsilon" type:FLOAT f:0.01 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_instancenorm_example.go b/backend/testbackend/onnx/onnx_test_instancenorm_example.go index e2d2e2a1..d32cfc0b 100644 --- a/backend/testbackend/onnx/onnx_test_instancenorm_example.go +++ b/backend/testbackend/onnx/onnx_test_instancenorm_example.go @@ -11,6 +11,148 @@ func init() { testbackend.Register("InstanceNormalization", "TestInstancenormExample", NewTestInstancenormExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "s", "bias"}, + Output: {"y"}, + Name: "", + OpType: "InstanceNormalization", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_instancenorm_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "s", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "bias", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestInstancenormExample version: 3. func NewTestInstancenormExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_leakyrelu.go b/backend/testbackend/onnx/onnx_test_leakyrelu.go index f2f83d45..b156c1bf 100644 --- a/backend/testbackend/onnx/onnx_test_leakyrelu.go +++ b/backend/testbackend/onnx/onnx_test_leakyrelu.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("LeakyRelu", "TestLeakyrelu", NewTestLeakyrelu) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "LeakyRelu", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "alpha", + RefAttrName: "", + DocString: "", + Type: 1, + F: 0.10000000149011612, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_leakyrelu", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestLeakyrelu version: 3. func NewTestLeakyrelu() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestLeakyrelu() *testbackend.TestCase { Name: "", OpType: "LeakyRelu", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc0004ce900)(name:"alpha" type:FLOAT f:0.1 ) + (*ir.AttributeProto)(0xc0001e6700)(name:"alpha" type:FLOAT f:0.1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_leakyrelu_default.go b/backend/testbackend/onnx/onnx_test_leakyrelu_default.go index 8878abc7..2e00f255 100644 --- a/backend/testbackend/onnx/onnx_test_leakyrelu_default.go +++ b/backend/testbackend/onnx/onnx_test_leakyrelu_default.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("LeakyRelu", "TestLeakyreluDefault", NewTestLeakyreluDefault) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "LeakyRelu", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_leakyrelu_default", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestLeakyreluDefault version: 3. func NewTestLeakyreluDefault() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_leakyrelu_example.go b/backend/testbackend/onnx/onnx_test_leakyrelu_example.go index 1bdbd035..73dc3b66 100644 --- a/backend/testbackend/onnx/onnx_test_leakyrelu_example.go +++ b/backend/testbackend/onnx/onnx_test_leakyrelu_example.go @@ -11,6 +11,103 @@ func init() { testbackend.Register("LeakyRelu", "TestLeakyreluExample", NewTestLeakyreluExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "LeakyRelu", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "alpha", + RefAttrName: "", + DocString: "", + Type: 1, + F: 0.10000000149011612, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_leakyrelu_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestLeakyreluExample version: 3. func NewTestLeakyreluExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +123,7 @@ func NewTestLeakyreluExample() *testbackend.TestCase { Name: "", OpType: "LeakyRelu", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000132700)(name:"alpha" type:FLOAT f:0.1 ) + (*ir.AttributeProto)(0xc000217100)(name:"alpha" type:FLOAT f:0.1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_log.go b/backend/testbackend/onnx/onnx_test_log.go index eec210fa..f1df993e 100644 --- a/backend/testbackend/onnx/onnx_test_log.go +++ b/backend/testbackend/onnx/onnx_test_log.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Log", "TestLog", NewTestLog) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Log", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_log", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestLog version: 3. func NewTestLog() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_log_example.go b/backend/testbackend/onnx/onnx_test_log_example.go index efc3db76..4763c727 100644 --- a/backend/testbackend/onnx/onnx_test_log_example.go +++ b/backend/testbackend/onnx/onnx_test_log_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Log", "TestLogExample", NewTestLogExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Log", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_log_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestLogExample version: 3. func NewTestLogExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_logsoftmax_axis_0.go b/backend/testbackend/onnx/onnx_test_logsoftmax_axis_0.go index 0726bca4..e21dd9de 100644 --- a/backend/testbackend/onnx/onnx_test_logsoftmax_axis_0.go +++ b/backend/testbackend/onnx/onnx_test_logsoftmax_axis_0.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("LogSoftmax", "TestLogsoftmaxAxis0", NewTestLogsoftmaxAxis0) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "LogSoftmax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_logsoftmax_axis_0", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestLogsoftmaxAxis0 version: 3. func NewTestLogsoftmaxAxis0() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestLogsoftmaxAxis0() *testbackend.TestCase { Name: "", OpType: "LogSoftmax", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000132c00)(name:"axis" type:INT ) + (*ir.AttributeProto)(0xc0001e6100)(name:"axis" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_logsoftmax_axis_1.go b/backend/testbackend/onnx/onnx_test_logsoftmax_axis_1.go index 1099b0d7..26e22e6f 100644 --- a/backend/testbackend/onnx/onnx_test_logsoftmax_axis_1.go +++ b/backend/testbackend/onnx/onnx_test_logsoftmax_axis_1.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("LogSoftmax", "TestLogsoftmaxAxis1", NewTestLogsoftmaxAxis1) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "LogSoftmax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_logsoftmax_axis_1", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestLogsoftmaxAxis1 version: 3. func NewTestLogsoftmaxAxis1() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestLogsoftmaxAxis1() *testbackend.TestCase { Name: "", OpType: "LogSoftmax", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000133100)(name:"axis" type:INT i:1 ) + (*ir.AttributeProto)(0xc0001e6700)(name:"axis" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_logsoftmax_axis_2.go b/backend/testbackend/onnx/onnx_test_logsoftmax_axis_2.go index 2c3e81ed..8be4e437 100644 --- a/backend/testbackend/onnx/onnx_test_logsoftmax_axis_2.go +++ b/backend/testbackend/onnx/onnx_test_logsoftmax_axis_2.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("LogSoftmax", "TestLogsoftmaxAxis2", NewTestLogsoftmaxAxis2) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "LogSoftmax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_logsoftmax_axis_2", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestLogsoftmaxAxis2 version: 3. func NewTestLogsoftmaxAxis2() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestLogsoftmaxAxis2() *testbackend.TestCase { Name: "", OpType: "LogSoftmax", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000133300)(name:"axis" type:INT i:2 ) + (*ir.AttributeProto)(0xc000216e00)(name:"axis" type:INT i:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_logsoftmax_default_axis.go b/backend/testbackend/onnx/onnx_test_logsoftmax_default_axis.go index d2cc21f1..8c6885ea 100644 --- a/backend/testbackend/onnx/onnx_test_logsoftmax_default_axis.go +++ b/backend/testbackend/onnx/onnx_test_logsoftmax_default_axis.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("LogSoftmax", "TestLogsoftmaxDefaultAxis", NewTestLogsoftmaxDefaultAxis) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "LogSoftmax", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_logsoftmax_default_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestLogsoftmaxDefaultAxis version: 3. func NewTestLogsoftmaxDefaultAxis() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_logsoftmax_example_1.go b/backend/testbackend/onnx/onnx_test_logsoftmax_example_1.go index 9fce5868..e12b8b9f 100644 --- a/backend/testbackend/onnx/onnx_test_logsoftmax_example_1.go +++ b/backend/testbackend/onnx/onnx_test_logsoftmax_example_1.go @@ -11,6 +11,92 @@ func init() { testbackend.Register("LogSoftmax", "TestLogsoftmaxExample1", NewTestLogsoftmaxExample1) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "LogSoftmax", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_logsoftmax_example_1", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestLogsoftmaxExample1 version: 3. func NewTestLogsoftmaxExample1() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_logsoftmax_large_number.go b/backend/testbackend/onnx/onnx_test_logsoftmax_large_number.go index 1be34b36..fe0ce283 100644 --- a/backend/testbackend/onnx/onnx_test_logsoftmax_large_number.go +++ b/backend/testbackend/onnx/onnx_test_logsoftmax_large_number.go @@ -11,6 +11,92 @@ func init() { testbackend.Register("LogSoftmax", "TestLogsoftmaxLargeNumber", NewTestLogsoftmaxLargeNumber) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "LogSoftmax", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_logsoftmax_large_number", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestLogsoftmaxLargeNumber version: 3. func NewTestLogsoftmaxLargeNumber() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_logsoftmax_negative_axis.go b/backend/testbackend/onnx/onnx_test_logsoftmax_negative_axis.go new file mode 100644 index 00000000..da8abae6 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_logsoftmax_negative_axis.go @@ -0,0 +1,165 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("LogSoftmax", "TestLogsoftmaxNegativeAxis", NewTestLogsoftmaxNegativeAxis) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "LogSoftmax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_logsoftmax_negative_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestLogsoftmaxNegativeAxis version: 6. +func NewTestLogsoftmaxNegativeAxis() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "LogSoftmax", + Title: "TestLogsoftmaxNegativeAxis", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x7b, 0xa, 0x28, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0xa, 0x4c, 0x6f, 0x67, 0x53, 0x6f, 0x66, 0x74, 0x6d, 0x61, 0x78, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1d, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6c, 0x6f, 0x67, 0x73, 0x6f, 0x66, 0x74, 0x6d, 0x61, 0x78, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "LogSoftmax", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217700)(name:"axis" type:INT i:-1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, 0.9772779, 0.95008844, 0.1513572, 0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, 0.20515826, 0.3130677, 0.85409576, 2.5529897, 0.6536186, 0.8644362, 0.742165, 2.2697546, 1.4543657, 0.045758516, 0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, 0.88778573, 1.9807965, 0.34791216, 0.15634897, 1.2302907, 1.2023798, 0.3873268, 0.30230275, 1.048553, 1.420018, 1.7062702, 1.9507754, 0.5096522, 0.4380743, 1.2527953, 0.7774904, 1.6138978, 0.21274029, 0.89546657, 0.3869025, 0.51080513, 1.1806322, 0.028182229, 0.42833188, 0.06651722, 0.3024719, 0.6343221, 0.36274117}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 5), + tensor.WithBacking([]float32{-1.4887761, -2.8526711, -2.2740903, -1.0119354, -1.3852705, -1.2225009, -1.2496903, -2.0484216, -2.09656, -1.7891803, -2.1846874, -0.8744575, -1.5676932, -2.207056, -1.8848677, -2.0454924, -0.88508755, -2.1740084, -2.066099, -1.5250709, -0.8115128, -2.710884, -2.5000663, -2.6223373, -1.0947479, -1.2872427, -2.69585, -2.5544245, -1.2088292, -1.2722496, -2.4640212, -2.240806, -1.7311828, -0.6381721, -2.2710564, -2.2181375, -1.1441958, -1.1721066, -1.9871596, -2.0721836, -2.005351, -1.6338862, -1.347634, -1.1031288, -2.544252, -2.1635222, -1.3488011, -1.8241062, -0.98769873, -2.3888562, -1.3942904, -1.9028544, -1.7789519, -1.1091248, -2.2615747, -1.5567553, -1.91857, -1.6826153, -1.3507651, -1.622346}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_logsoftmax_negative_axis_test.go b/backend/testbackend/onnx/onnx_test_logsoftmax_negative_axis_test.go new file mode 100644 index 00000000..64ada21f --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_logsoftmax_negative_axis_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestLogsoftmaxNegativeAxis(t *testing.T) { + mytest := NewTestLogsoftmaxNegativeAxis() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_lrn.go b/backend/testbackend/onnx/onnx_test_lrn.go index c933a99d..798fba6d 100644 --- a/backend/testbackend/onnx/onnx_test_lrn.go +++ b/backend/testbackend/onnx/onnx_test_lrn.go @@ -11,6 +11,181 @@ func init() { testbackend.Register("LRN", "TestLrn", NewTestLrn) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "LRN", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "alpha", + RefAttrName: "", + DocString: "", + Type: 1, + F: 0.00019999999494757503, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "beta", + RefAttrName: "", + DocString: "", + Type: 1, + F: 0.5, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "bias", + RefAttrName: "", + DocString: "", + Type: 1, + F: 2, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "size", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 3, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_lrn", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestLrn version: 3. func NewTestLrn() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,10 +201,10 @@ func NewTestLrn() *testbackend.TestCase { Name: "", OpType: "LRN", Attributes: ([]*ir.AttributeProto) (len=4 cap=4) { - (*ir.AttributeProto)(0xc000133e00)(name:"alpha" type:FLOAT f:0.0002 ), - (*ir.AttributeProto)(0xc000133f00)(name:"beta" type:FLOAT f:0.5 ), - (*ir.AttributeProto)(0xc000126000)(name:"bias" type:FLOAT f:2 ), - (*ir.AttributeProto)(0xc000126100)(name:"size" type:INT i:3 ) + (*ir.AttributeProto)(0xc000217b00)(name:"alpha" type:FLOAT f:0.0002 ), + (*ir.AttributeProto)(0xc000217c00)(name:"beta" type:FLOAT f:0.5 ), + (*ir.AttributeProto)(0xc000217d00)(name:"bias" type:FLOAT f:2 ), + (*ir.AttributeProto)(0xc000217e00)(name:"size" type:INT i:3 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_lrn_default.go b/backend/testbackend/onnx/onnx_test_lrn_default.go index 4971c41a..197718bc 100644 --- a/backend/testbackend/onnx/onnx_test_lrn_default.go +++ b/backend/testbackend/onnx/onnx_test_lrn_default.go @@ -11,6 +11,127 @@ func init() { testbackend.Register("LRN", "TestLrnDefault", NewTestLrnDefault) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "LRN", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "size", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 3, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_lrn_default", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestLrnDefault version: 3. func NewTestLrnDefault() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +147,7 @@ func NewTestLrnDefault() *testbackend.TestCase { Name: "", OpType: "LRN", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000118300)(name:"size" type:INT i:3 ) + (*ir.AttributeProto)(0xc0001e6600)(name:"size" type:INT i:3 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_matmul_2d.go b/backend/testbackend/onnx/onnx_test_matmul_2d.go index 185bf2bc..01451f12 100644 --- a/backend/testbackend/onnx/onnx_test_matmul_2d.go +++ b/backend/testbackend/onnx/onnx_test_matmul_2d.go @@ -11,6 +11,116 @@ func init() { testbackend.Register("MatMul", "TestMatmul2d", NewTestMatmul2d) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a", "b"}, + Output: {"c"}, + Name: "", + OpType: "MatMul", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_matmul_2d", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "c", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMatmul2d version: 3. func NewTestMatmul2d() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_matmul_3d.go b/backend/testbackend/onnx/onnx_test_matmul_3d.go index 36a3e8ed..1e4dd02f 100644 --- a/backend/testbackend/onnx/onnx_test_matmul_3d.go +++ b/backend/testbackend/onnx/onnx_test_matmul_3d.go @@ -11,6 +11,128 @@ func init() { testbackend.Register("MatMul", "TestMatmul3d", NewTestMatmul3d) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a", "b"}, + Output: {"c"}, + Name: "", + OpType: "MatMul", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_matmul_3d", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "c", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMatmul3d version: 3. func NewTestMatmul3d() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_matmul_4d.go b/backend/testbackend/onnx/onnx_test_matmul_4d.go index 6e28eac8..74569fc2 100644 --- a/backend/testbackend/onnx/onnx_test_matmul_4d.go +++ b/backend/testbackend/onnx/onnx_test_matmul_4d.go @@ -11,6 +11,140 @@ func init() { testbackend.Register("MatMul", "TestMatmul4d", NewTestMatmul4d) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"a", "b"}, + Output: {"c"}, + Name: "", + OpType: "MatMul", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_matmul_4d", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "a", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "b", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "c", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMatmul4d version: 3. func NewTestMatmul4d() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_max_example.go b/backend/testbackend/onnx/onnx_test_max_example.go index bb04ff09..930f90b3 100644 --- a/backend/testbackend/onnx/onnx_test_max_example.go +++ b/backend/testbackend/onnx/onnx_test_max_example.go @@ -11,6 +11,124 @@ func init() { testbackend.Register("Max", "TestMaxExample", NewTestMaxExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data_0", "data_1", "data_2"}, + Output: {"result"}, + Name: "", + OpType: "Max", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_max_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data_0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "data_1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "data_2", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxExample version: 3. func NewTestMaxExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_max_one_input.go b/backend/testbackend/onnx/onnx_test_max_one_input.go index 4bece545..a3e828b4 100644 --- a/backend/testbackend/onnx/onnx_test_max_one_input.go +++ b/backend/testbackend/onnx/onnx_test_max_one_input.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Max", "TestMaxOneInput", NewTestMaxOneInput) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data_0"}, + Output: {"result"}, + Name: "", + OpType: "Max", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_max_one_input", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data_0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxOneInput version: 3. func NewTestMaxOneInput() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_max_two_inputs.go b/backend/testbackend/onnx/onnx_test_max_two_inputs.go index e63b8318..772f8bb7 100644 --- a/backend/testbackend/onnx/onnx_test_max_two_inputs.go +++ b/backend/testbackend/onnx/onnx_test_max_two_inputs.go @@ -11,6 +11,104 @@ func init() { testbackend.Register("Max", "TestMaxTwoInputs", NewTestMaxTwoInputs) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data_0", "data_1"}, + Output: {"result"}, + Name: "", + OpType: "Max", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_max_two_inputs", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data_0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "data_1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxTwoInputs version: 3. func NewTestMaxTwoInputs() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_maxpool_1d_default.go b/backend/testbackend/onnx/onnx_test_maxpool_1d_default.go index efd8d316..c80502a9 100644 --- a/backend/testbackend/onnx/onnx_test_maxpool_1d_default.go +++ b/backend/testbackend/onnx/onnx_test_maxpool_1d_default.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("MaxPool", "TestMaxpool1dDefault", NewTestMaxpool1dDefault) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "MaxPool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_maxpool_1d_default", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:31}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxpool1dDefault version: 3. func NewTestMaxpool1dDefault() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestMaxpool1dDefault() *testbackend.TestCase { Name: "", OpType: "MaxPool", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126000)(name:"kernel_shape" type:INTS ints:2 ) + (*ir.AttributeProto)(0xc000216b00)(name:"kernel_shape" type:INTS ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_maxpool_2d_ceil.go b/backend/testbackend/onnx/onnx_test_maxpool_2d_ceil.go index 4c71436a..40e4cdda 100644 --- a/backend/testbackend/onnx/onnx_test_maxpool_2d_ceil.go +++ b/backend/testbackend/onnx/onnx_test_maxpool_2d_ceil.go @@ -11,6 +11,163 @@ func init() { testbackend.Register("MaxPool", "TestMaxpool2dCeil", NewTestMaxpool2dCeil) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "MaxPool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "ceil_mode", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 3}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_maxpool_2d_ceil", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxpool2dCeil version: 4. func NewTestMaxpool2dCeil() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,9 +183,9 @@ func NewTestMaxpool2dCeil() *testbackend.TestCase { Name: "", OpType: "MaxPool", Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { - (*ir.AttributeProto)(0xc000132800)(name:"ceil_mode" type:INT i:1 ), - (*ir.AttributeProto)(0xc000132900)(name:"kernel_shape" type:INTS ints:3 ints:3 ), - (*ir.AttributeProto)(0xc000132a00)(name:"strides" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc000216f00)(name:"ceil_mode" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217000)(name:"kernel_shape" type:INTS ints:3 ints:3 ), + (*ir.AttributeProto)(0xc000217100)(name:"strides" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_maxpool_2d_default.go b/backend/testbackend/onnx/onnx_test_maxpool_2d_default.go index 05b62a88..88cd1ccf 100644 --- a/backend/testbackend/onnx/onnx_test_maxpool_2d_default.go +++ b/backend/testbackend/onnx/onnx_test_maxpool_2d_default.go @@ -11,6 +11,127 @@ func init() { testbackend.Register("MaxPool", "TestMaxpool2dDefault", NewTestMaxpool2dDefault) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "MaxPool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_maxpool_2d_default", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:31}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:31}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxpool2dDefault version: 3. func NewTestMaxpool2dDefault() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +147,7 @@ func NewTestMaxpool2dDefault() *testbackend.TestCase { Name: "", OpType: "MaxPool", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126700)(name:"kernel_shape" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc000217400)(name:"kernel_shape" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_maxpool_2d_dilations.go b/backend/testbackend/onnx/onnx_test_maxpool_2d_dilations.go index 150db512..be17bb8a 100644 --- a/backend/testbackend/onnx/onnx_test_maxpool_2d_dilations.go +++ b/backend/testbackend/onnx/onnx_test_maxpool_2d_dilations.go @@ -11,6 +11,163 @@ func init() { testbackend.Register("MaxPool", "TestMaxpool2dDilations", NewTestMaxpool2dDilations) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "MaxPool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "dilations", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1, 1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_maxpool_2d_dilations", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxpool2dDilations version: 4. func NewTestMaxpool2dDilations() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,9 +183,9 @@ func NewTestMaxpool2dDilations() *testbackend.TestCase { Name: "", OpType: "MaxPool", Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { - (*ir.AttributeProto)(0xc000126100)(name:"dilations" type:INTS ints:2 ints:2 ), - (*ir.AttributeProto)(0xc000126300)(name:"kernel_shape" type:INTS ints:2 ints:2 ), - (*ir.AttributeProto)(0xc000126400)(name:"strides" type:INTS ints:1 ints:1 ) + (*ir.AttributeProto)(0xc0001e6100)(name:"dilations" type:INTS ints:2 ints:2 ), + (*ir.AttributeProto)(0xc0001e6400)(name:"kernel_shape" type:INTS ints:2 ints:2 ), + (*ir.AttributeProto)(0xc0001e6500)(name:"strides" type:INTS ints:1 ints:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_maxpool_2d_pads.go b/backend/testbackend/onnx/onnx_test_maxpool_2d_pads.go index 0aedfa13..c866c5e9 100644 --- a/backend/testbackend/onnx/onnx_test_maxpool_2d_pads.go +++ b/backend/testbackend/onnx/onnx_test_maxpool_2d_pads.go @@ -11,6 +11,145 @@ func init() { testbackend.Register("MaxPool", "TestMaxpool2dPads", NewTestMaxpool2dPads) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "MaxPool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 3}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pads", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2, 2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_maxpool_2d_pads", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:28}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:28}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:30}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:30}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxpool2dPads version: 3. func NewTestMaxpool2dPads() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +165,8 @@ func NewTestMaxpool2dPads() *testbackend.TestCase { Name: "", OpType: "MaxPool", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000126600)(name:"kernel_shape" type:INTS ints:3 ints:3 ), - (*ir.AttributeProto)(0xc000126700)(name:"pads" type:INTS ints:2 ints:2 ints:2 ints:2 ) + (*ir.AttributeProto)(0xc000216b00)(name:"kernel_shape" type:INTS ints:3 ints:3 ), + (*ir.AttributeProto)(0xc000216c00)(name:"pads" type:INTS ints:2 ints:2 ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_maxpool_2d_precomputed_pads.go b/backend/testbackend/onnx/onnx_test_maxpool_2d_precomputed_pads.go index b2fcd0c8..067dc8a2 100644 --- a/backend/testbackend/onnx/onnx_test_maxpool_2d_precomputed_pads.go +++ b/backend/testbackend/onnx/onnx_test_maxpool_2d_precomputed_pads.go @@ -11,6 +11,145 @@ func init() { testbackend.Register("MaxPool", "TestMaxpool2dPrecomputedPads", NewTestMaxpool2dPrecomputedPads) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "MaxPool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {5, 5}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pads", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2, 2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_maxpool_2d_precomputed_pads", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxpool2dPrecomputedPads version: 3. func NewTestMaxpool2dPrecomputedPads() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +165,8 @@ func NewTestMaxpool2dPrecomputedPads() *testbackend.TestCase { Name: "", OpType: "MaxPool", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132300)(name:"kernel_shape" type:INTS ints:5 ints:5 ), - (*ir.AttributeProto)(0xc000132400)(name:"pads" type:INTS ints:2 ints:2 ints:2 ints:2 ) + (*ir.AttributeProto)(0xc0001e6400)(name:"kernel_shape" type:INTS ints:5 ints:5 ), + (*ir.AttributeProto)(0xc0001e6500)(name:"pads" type:INTS ints:2 ints:2 ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_maxpool_2d_precomputed_same_upper.go b/backend/testbackend/onnx/onnx_test_maxpool_2d_precomputed_same_upper.go index 4299c047..f8f5700e 100644 --- a/backend/testbackend/onnx/onnx_test_maxpool_2d_precomputed_same_upper.go +++ b/backend/testbackend/onnx/onnx_test_maxpool_2d_precomputed_same_upper.go @@ -11,6 +11,163 @@ func init() { testbackend.Register("MaxPool", "TestMaxpool2dPrecomputedSameUpper", NewTestMaxpool2dPrecomputedSameUpper) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "MaxPool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "auto_pad", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x53, 0x41, 0x4d, 0x45, 0x5f, 0x55, 0x50, 0x50, 0x45, 0x52}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 3}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_maxpool_2d_precomputed_same_upper", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxpool2dPrecomputedSameUpper version: 3. func NewTestMaxpool2dPrecomputedSameUpper() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,9 +183,9 @@ func NewTestMaxpool2dPrecomputedSameUpper() *testbackend.TestCase { Name: "", OpType: "MaxPool", Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { - (*ir.AttributeProto)(0xc000126600)(name:"auto_pad" type:STRING s:"SAME_UPPER" ), - (*ir.AttributeProto)(0xc000126700)(name:"kernel_shape" type:INTS ints:3 ints:3 ), - (*ir.AttributeProto)(0xc000126800)(name:"strides" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc000216d00)(name:"auto_pad" type:STRING s:"SAME_UPPER" ), + (*ir.AttributeProto)(0xc000216e00)(name:"kernel_shape" type:INTS ints:3 ints:3 ), + (*ir.AttributeProto)(0xc000216f00)(name:"strides" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_maxpool_2d_precomputed_strides.go b/backend/testbackend/onnx/onnx_test_maxpool_2d_precomputed_strides.go index 75bf37d4..5cad7ed5 100644 --- a/backend/testbackend/onnx/onnx_test_maxpool_2d_precomputed_strides.go +++ b/backend/testbackend/onnx/onnx_test_maxpool_2d_precomputed_strides.go @@ -11,6 +11,145 @@ func init() { testbackend.Register("MaxPool", "TestMaxpool2dPrecomputedStrides", NewTestMaxpool2dPrecomputedStrides) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "MaxPool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_maxpool_2d_precomputed_strides", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxpool2dPrecomputedStrides version: 3. func NewTestMaxpool2dPrecomputedStrides() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +165,8 @@ func NewTestMaxpool2dPrecomputedStrides() *testbackend.TestCase { Name: "", OpType: "MaxPool", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000126a00)(name:"kernel_shape" type:INTS ints:2 ints:2 ), - (*ir.AttributeProto)(0xc000126b00)(name:"strides" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc0001e6600)(name:"kernel_shape" type:INTS ints:2 ints:2 ), + (*ir.AttributeProto)(0xc0001e6700)(name:"strides" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_maxpool_2d_same_lower.go b/backend/testbackend/onnx/onnx_test_maxpool_2d_same_lower.go index 50c09d64..7563aa8c 100644 --- a/backend/testbackend/onnx/onnx_test_maxpool_2d_same_lower.go +++ b/backend/testbackend/onnx/onnx_test_maxpool_2d_same_lower.go @@ -11,6 +11,145 @@ func init() { testbackend.Register("MaxPool", "TestMaxpool2dSameLower", NewTestMaxpool2dSameLower) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "MaxPool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "auto_pad", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x53, 0x41, 0x4d, 0x45, 0x5f, 0x4c, 0x4f, 0x57, 0x45, 0x52}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_maxpool_2d_same_lower", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxpool2dSameLower version: 3. func NewTestMaxpool2dSameLower() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +165,8 @@ func NewTestMaxpool2dSameLower() *testbackend.TestCase { Name: "", OpType: "MaxPool", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132b00)(name:"auto_pad" type:STRING s:"SAME_LOWER" ), - (*ir.AttributeProto)(0xc000132c00)(name:"kernel_shape" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc000217300)(name:"auto_pad" type:STRING s:"SAME_LOWER" ), + (*ir.AttributeProto)(0xc000217400)(name:"kernel_shape" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_maxpool_2d_same_upper.go b/backend/testbackend/onnx/onnx_test_maxpool_2d_same_upper.go index 5d37d6cd..60168dfd 100644 --- a/backend/testbackend/onnx/onnx_test_maxpool_2d_same_upper.go +++ b/backend/testbackend/onnx/onnx_test_maxpool_2d_same_upper.go @@ -11,6 +11,145 @@ func init() { testbackend.Register("MaxPool", "TestMaxpool2dSameUpper", NewTestMaxpool2dSameUpper) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "MaxPool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "auto_pad", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x53, 0x41, 0x4d, 0x45, 0x5f, 0x55, 0x50, 0x50, 0x45, 0x52}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_maxpool_2d_same_upper", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxpool2dSameUpper version: 3. func NewTestMaxpool2dSameUpper() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +165,8 @@ func NewTestMaxpool2dSameUpper() *testbackend.TestCase { Name: "", OpType: "MaxPool", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000126100)(name:"auto_pad" type:STRING s:"SAME_UPPER" ), - (*ir.AttributeProto)(0xc000126300)(name:"kernel_shape" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc0001e6400)(name:"auto_pad" type:STRING s:"SAME_UPPER" ), + (*ir.AttributeProto)(0xc0001e6500)(name:"kernel_shape" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_maxpool_2d_strides.go b/backend/testbackend/onnx/onnx_test_maxpool_2d_strides.go index 810b966e..c7702d7f 100644 --- a/backend/testbackend/onnx/onnx_test_maxpool_2d_strides.go +++ b/backend/testbackend/onnx/onnx_test_maxpool_2d_strides.go @@ -11,6 +11,145 @@ func init() { testbackend.Register("MaxPool", "TestMaxpool2dStrides", NewTestMaxpool2dStrides) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "MaxPool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {5, 5}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3, 3}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_maxpool_2d_strides", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxpool2dStrides version: 3. func NewTestMaxpool2dStrides() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +165,8 @@ func NewTestMaxpool2dStrides() *testbackend.TestCase { Name: "", OpType: "MaxPool", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000126300)(name:"kernel_shape" type:INTS ints:5 ints:5 ), - (*ir.AttributeProto)(0xc000126400)(name:"strides" type:INTS ints:3 ints:3 ) + (*ir.AttributeProto)(0xc0001e6400)(name:"kernel_shape" type:INTS ints:5 ints:5 ), + (*ir.AttributeProto)(0xc0001e6500)(name:"strides" type:INTS ints:3 ints:3 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_maxpool_3d_default.go b/backend/testbackend/onnx/onnx_test_maxpool_3d_default.go index 089eb01c..dede5a21 100644 --- a/backend/testbackend/onnx/onnx_test_maxpool_3d_default.go +++ b/backend/testbackend/onnx/onnx_test_maxpool_3d_default.go @@ -11,6 +11,135 @@ func init() { testbackend.Register("MaxPool", "TestMaxpool3dDefault", NewTestMaxpool3dDefault) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "MaxPool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_maxpool_3d_default", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:32}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:31}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:31}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:31}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxpool3dDefault version: 3. func NewTestMaxpool3dDefault() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +155,7 @@ func NewTestMaxpool3dDefault() *testbackend.TestCase { Name: "", OpType: "MaxPool", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126000)(name:"kernel_shape" type:INTS ints:2 ints:2 ints:2 ) + (*ir.AttributeProto)(0xc0001e6500)(name:"kernel_shape" type:INTS ints:2 ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_maxpool_with_argmax_2d_precomputed_pads.go b/backend/testbackend/onnx/onnx_test_maxpool_with_argmax_2d_precomputed_pads.go index 61903439..8325e2c1 100644 --- a/backend/testbackend/onnx/onnx_test_maxpool_with_argmax_2d_precomputed_pads.go +++ b/backend/testbackend/onnx/onnx_test_maxpool_with_argmax_2d_precomputed_pads.go @@ -11,6 +11,177 @@ func init() { testbackend.Register("MaxPool", "TestMaxpoolWithArgmax2dPrecomputedPads", NewTestMaxpoolWithArgmax2dPrecomputedPads) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y", "z"}, + Name: "", + OpType: "MaxPool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {5, 5}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pads", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2, 2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_maxpool_with_argmax_2d_precomputed_pads", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxpoolWithArgmax2dPrecomputedPads version: 3. func NewTestMaxpoolWithArgmax2dPrecomputedPads() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +197,8 @@ func NewTestMaxpoolWithArgmax2dPrecomputedPads() *testbackend.TestCase { Name: "", OpType: "MaxPool", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000126100)(name:"kernel_shape" type:INTS ints:5 ints:5 ), - (*ir.AttributeProto)(0xc000126300)(name:"pads" type:INTS ints:2 ints:2 ints:2 ints:2 ) + (*ir.AttributeProto)(0xc0001e6100)(name:"kernel_shape" type:INTS ints:5 ints:5 ), + (*ir.AttributeProto)(0xc0001e6400)(name:"pads" type:INTS ints:2 ints:2 ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_maxpool_with_argmax_2d_precomputed_strides.go b/backend/testbackend/onnx/onnx_test_maxpool_with_argmax_2d_precomputed_strides.go index b04b55c8..fd454ada 100644 --- a/backend/testbackend/onnx/onnx_test_maxpool_with_argmax_2d_precomputed_strides.go +++ b/backend/testbackend/onnx/onnx_test_maxpool_with_argmax_2d_precomputed_strides.go @@ -11,6 +11,195 @@ func init() { testbackend.Register("MaxPool", "TestMaxpoolWithArgmax2dPrecomputedStrides", NewTestMaxpoolWithArgmax2dPrecomputedStrides) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y", "z"}, + Name: "", + OpType: "MaxPool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "storage_order", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_maxpool_with_argmax_2d_precomputed_strides", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxpoolWithArgmax2dPrecomputedStrides version: 3. func NewTestMaxpoolWithArgmax2dPrecomputedStrides() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,9 +215,9 @@ func NewTestMaxpoolWithArgmax2dPrecomputedStrides() *testbackend.TestCase { Name: "", OpType: "MaxPool", Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { - (*ir.AttributeProto)(0xc000126c00)(name:"kernel_shape" type:INTS ints:2 ints:2 ), - (*ir.AttributeProto)(0xc000126d00)(name:"storage_order" type:INT i:1 ), - (*ir.AttributeProto)(0xc000126e00)(name:"strides" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc000216e00)(name:"kernel_shape" type:INTS ints:2 ints:2 ), + (*ir.AttributeProto)(0xc000216f00)(name:"storage_order" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217000)(name:"strides" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_maxunpool_export_with_output_shape.go b/backend/testbackend/onnx/onnx_test_maxunpool_export_with_output_shape.go index 96fada89..fb02b5e7 100644 --- a/backend/testbackend/onnx/onnx_test_maxunpool_export_with_output_shape.go +++ b/backend/testbackend/onnx/onnx_test_maxunpool_export_with_output_shape.go @@ -11,6 +11,197 @@ func init() { testbackend.Register("MaxUnpool", "TestMaxunpoolExportWithOutputShape", NewTestMaxunpoolExportWithOutputShape) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"xT", "xI", "output_shape"}, + Output: {"y"}, + Name: "", + OpType: "MaxUnpool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_maxunpool_export_with_output_shape", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "xT", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "xI", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "output_shape", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxunpoolExportWithOutputShape version: 3. func NewTestMaxunpoolExportWithOutputShape() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +217,8 @@ func NewTestMaxunpoolExportWithOutputShape() *testbackend.TestCase { Name: "", OpType: "MaxUnpool", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132800)(name:"kernel_shape" type:INTS ints:2 ints:2 ), - (*ir.AttributeProto)(0xc000132900)(name:"strides" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc000217400)(name:"kernel_shape" type:INTS ints:2 ints:2 ), + (*ir.AttributeProto)(0xc000217500)(name:"strides" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_maxunpool_export_without_output_shape.go b/backend/testbackend/onnx/onnx_test_maxunpool_export_without_output_shape.go index 2e716641..d7285e38 100644 --- a/backend/testbackend/onnx/onnx_test_maxunpool_export_without_output_shape.go +++ b/backend/testbackend/onnx/onnx_test_maxunpool_export_without_output_shape.go @@ -11,6 +11,177 @@ func init() { testbackend.Register("MaxUnpool", "TestMaxunpoolExportWithoutOutputShape", NewTestMaxunpoolExportWithoutOutputShape) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"xT", "xI"}, + Output: {"y"}, + Name: "", + OpType: "MaxUnpool", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "kernel_shape", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "strides", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_maxunpool_export_without_output_shape", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "xT", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "xI", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMaxunpoolExportWithoutOutputShape version: 3. func NewTestMaxunpoolExportWithoutOutputShape() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +197,8 @@ func NewTestMaxunpoolExportWithoutOutputShape() *testbackend.TestCase { Name: "", OpType: "MaxUnpool", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000126f00)(name:"kernel_shape" type:INTS ints:2 ints:2 ), - (*ir.AttributeProto)(0xc000127000)(name:"strides" type:INTS ints:2 ints:2 ) + (*ir.AttributeProto)(0xc000217a00)(name:"kernel_shape" type:INTS ints:2 ints:2 ), + (*ir.AttributeProto)(0xc000217b00)(name:"strides" type:INTS ints:2 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_mean_example.go b/backend/testbackend/onnx/onnx_test_mean_example.go index 7a7cb6dd..4ac3ff04 100644 --- a/backend/testbackend/onnx/onnx_test_mean_example.go +++ b/backend/testbackend/onnx/onnx_test_mean_example.go @@ -11,6 +11,124 @@ func init() { testbackend.Register("Mean", "TestMeanExample", NewTestMeanExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data_0", "data_1", "data_2"}, + Output: {"result"}, + Name: "", + OpType: "Mean", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_mean_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data_0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "data_1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "data_2", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMeanExample version: 3. func NewTestMeanExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_mean_one_input.go b/backend/testbackend/onnx/onnx_test_mean_one_input.go index b5ea4441..6efcf965 100644 --- a/backend/testbackend/onnx/onnx_test_mean_one_input.go +++ b/backend/testbackend/onnx/onnx_test_mean_one_input.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Mean", "TestMeanOneInput", NewTestMeanOneInput) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data_0"}, + Output: {"result"}, + Name: "", + OpType: "Mean", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_mean_one_input", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data_0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMeanOneInput version: 3. func NewTestMeanOneInput() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_mean_two_inputs.go b/backend/testbackend/onnx/onnx_test_mean_two_inputs.go index edf52047..4e8fa7b5 100644 --- a/backend/testbackend/onnx/onnx_test_mean_two_inputs.go +++ b/backend/testbackend/onnx/onnx_test_mean_two_inputs.go @@ -11,6 +11,104 @@ func init() { testbackend.Register("Mean", "TestMeanTwoInputs", NewTestMeanTwoInputs) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data_0", "data_1"}, + Output: {"result"}, + Name: "", + OpType: "Mean", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_mean_two_inputs", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data_0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "data_1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMeanTwoInputs version: 3. func NewTestMeanTwoInputs() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_min_example.go b/backend/testbackend/onnx/onnx_test_min_example.go index e8e17edd..eb861525 100644 --- a/backend/testbackend/onnx/onnx_test_min_example.go +++ b/backend/testbackend/onnx/onnx_test_min_example.go @@ -11,6 +11,124 @@ func init() { testbackend.Register("Min", "TestMinExample", NewTestMinExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data_0", "data_1", "data_2"}, + Output: {"result"}, + Name: "", + OpType: "Min", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_min_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data_0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "data_1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "data_2", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMinExample version: 3. func NewTestMinExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_min_one_input.go b/backend/testbackend/onnx/onnx_test_min_one_input.go index 74024c43..1feca12d 100644 --- a/backend/testbackend/onnx/onnx_test_min_one_input.go +++ b/backend/testbackend/onnx/onnx_test_min_one_input.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Min", "TestMinOneInput", NewTestMinOneInput) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data_0"}, + Output: {"result"}, + Name: "", + OpType: "Min", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_min_one_input", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data_0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMinOneInput version: 3. func NewTestMinOneInput() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_min_two_inputs.go b/backend/testbackend/onnx/onnx_test_min_two_inputs.go index 729109b4..670da544 100644 --- a/backend/testbackend/onnx/onnx_test_min_two_inputs.go +++ b/backend/testbackend/onnx/onnx_test_min_two_inputs.go @@ -11,6 +11,104 @@ func init() { testbackend.Register("Min", "TestMinTwoInputs", NewTestMinTwoInputs) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data_0", "data_1"}, + Output: {"result"}, + Name: "", + OpType: "Min", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_min_two_inputs", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data_0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "data_1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMinTwoInputs version: 3. func NewTestMinTwoInputs() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_mod_broadcast.go b/backend/testbackend/onnx/onnx_test_mod_broadcast.go index d6210d0a..4d505540 100644 --- a/backend/testbackend/onnx/onnx_test_mod_broadcast.go +++ b/backend/testbackend/onnx/onnx_test_mod_broadcast.go @@ -11,6 +11,120 @@ func init() { testbackend.Register("Mod", "TestModBroadcast", NewTestModBroadcast) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Mod", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_mod_broadcast", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestModBroadcast version: 5. func NewTestModBroadcast() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_mod_int64_fmod.go b/backend/testbackend/onnx/onnx_test_mod_int64_fmod.go index 5e724834..1fb33617 100644 --- a/backend/testbackend/onnx/onnx_test_mod_int64_fmod.go +++ b/backend/testbackend/onnx/onnx_test_mod_int64_fmod.go @@ -11,6 +11,123 @@ func init() { testbackend.Register("Mod", "TestModInt64Fmod", NewTestModInt64Fmod) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Mod", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "fmod", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_mod_int64_fmod", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestModInt64Fmod version: 5. func NewTestModInt64Fmod() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +143,7 @@ func NewTestModInt64Fmod() *testbackend.TestCase { Name: "", OpType: "Mod", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000118700)(name:"fmod" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217100)(name:"fmod" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_mod_mixed_sign_float32.go b/backend/testbackend/onnx/onnx_test_mod_mixed_sign_float32.go index 6bc63176..8d0da351 100644 --- a/backend/testbackend/onnx/onnx_test_mod_mixed_sign_float32.go +++ b/backend/testbackend/onnx/onnx_test_mod_mixed_sign_float32.go @@ -11,6 +11,123 @@ func init() { testbackend.Register("Mod", "TestModMixedSignFloat32", NewTestModMixedSignFloat32) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Mod", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "fmod", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_mod_mixed_sign_float32", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestModMixedSignFloat32 version: 5. func NewTestModMixedSignFloat32() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +143,7 @@ func NewTestModMixedSignFloat32() *testbackend.TestCase { Name: "", OpType: "Mod", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000127f00)(name:"fmod" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217500)(name:"fmod" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_mod_mixed_sign_float64.go b/backend/testbackend/onnx/onnx_test_mod_mixed_sign_float64.go index 377b1dfd..33742cf9 100644 --- a/backend/testbackend/onnx/onnx_test_mod_mixed_sign_float64.go +++ b/backend/testbackend/onnx/onnx_test_mod_mixed_sign_float64.go @@ -11,6 +11,123 @@ func init() { testbackend.Register("Mod", "TestModMixedSignFloat64", NewTestModMixedSignFloat64) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Mod", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "fmod", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_mod_mixed_sign_float64", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 11, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestModMixedSignFloat64 version: 5. func NewTestModMixedSignFloat64() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +143,7 @@ func NewTestModMixedSignFloat64() *testbackend.TestCase { Name: "", OpType: "Mod", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc00030c400)(name:"fmod" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217800)(name:"fmod" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_mod_mixed_sign_int32.go b/backend/testbackend/onnx/onnx_test_mod_mixed_sign_int32.go index c5fdb5c7..82b91db2 100644 --- a/backend/testbackend/onnx/onnx_test_mod_mixed_sign_int32.go +++ b/backend/testbackend/onnx/onnx_test_mod_mixed_sign_int32.go @@ -11,6 +11,104 @@ func init() { testbackend.Register("Mod", "TestModMixedSignInt32", NewTestModMixedSignInt32) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Mod", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_mod_mixed_sign_int32", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestModMixedSignInt32 version: 5. func NewTestModMixedSignInt32() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_mod_mixed_sign_int64.go b/backend/testbackend/onnx/onnx_test_mod_mixed_sign_int64.go index fe785473..fdeacb95 100644 --- a/backend/testbackend/onnx/onnx_test_mod_mixed_sign_int64.go +++ b/backend/testbackend/onnx/onnx_test_mod_mixed_sign_int64.go @@ -11,6 +11,104 @@ func init() { testbackend.Register("Mod", "TestModMixedSignInt64", NewTestModMixedSignInt64) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Mod", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_mod_mixed_sign_int64", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestModMixedSignInt64 version: 5. func NewTestModMixedSignInt64() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_mul.go b/backend/testbackend/onnx/onnx_test_mul.go index f470d3fa..b0a7f221 100644 --- a/backend/testbackend/onnx/onnx_test_mul.go +++ b/backend/testbackend/onnx/onnx_test_mul.go @@ -11,6 +11,128 @@ func init() { testbackend.Register("Mul", "TestMul", NewTestMul) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Mul", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_mul", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMul version: 3. func NewTestMul() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_mul_bcast.go b/backend/testbackend/onnx/onnx_test_mul_bcast.go index 431be719..79edb00e 100644 --- a/backend/testbackend/onnx/onnx_test_mul_bcast.go +++ b/backend/testbackend/onnx/onnx_test_mul_bcast.go @@ -11,6 +11,120 @@ func init() { testbackend.Register("Mul", "TestMulBcast", NewTestMulBcast) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Mul", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_mul_bcast", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMulBcast version: 3. func NewTestMulBcast() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_mul_example.go b/backend/testbackend/onnx/onnx_test_mul_example.go index f430ce0b..f8fe7329 100644 --- a/backend/testbackend/onnx/onnx_test_mul_example.go +++ b/backend/testbackend/onnx/onnx_test_mul_example.go @@ -11,6 +11,104 @@ func init() { testbackend.Register("Mul", "TestMulExample", NewTestMulExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Mul", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_mul_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMulExample version: 3. func NewTestMulExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_mvn.go b/backend/testbackend/onnx/onnx_test_mvn.go index 8362d268..858133b4 100644 --- a/backend/testbackend/onnx/onnx_test_mvn.go +++ b/backend/testbackend/onnx/onnx_test_mvn.go @@ -11,6 +11,108 @@ func init() { testbackend.Register("MeanVarianceNormalization", "TestMvn", NewTestMvn) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X"}, + Output: {"Y"}, + Name: "", + OpType: "MeanVarianceNormalization", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_mvn", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestMvn version: 4. func NewTestMvn() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_neg.go b/backend/testbackend/onnx/onnx_test_neg.go index 10cb616c..0294de80 100644 --- a/backend/testbackend/onnx/onnx_test_neg.go +++ b/backend/testbackend/onnx/onnx_test_neg.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Neg", "TestNeg", NewTestNeg) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Neg", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_neg", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestNeg version: 3. func NewTestNeg() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_neg_example.go b/backend/testbackend/onnx/onnx_test_neg_example.go index 2cf656f3..0dd1e21a 100644 --- a/backend/testbackend/onnx/onnx_test_neg_example.go +++ b/backend/testbackend/onnx/onnx_test_neg_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Neg", "TestNegExample", NewTestNegExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Neg", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_neg_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestNegExample version: 3. func NewTestNegExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NC.go b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NC.go new file mode 100644 index 00000000..ae71aae3 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NC.go @@ -0,0 +1,178 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("NegativeLogLikelihoodLoss", "TestNegativeLogLikelihoodLossInputShapeIsNC", NewTestNegativeLogLikelihoodLossInputShapeIsNC) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"input", "target"}, + Output: {"loss"}, + Name: "", + OpType: "NegativeLogLikelihoodLoss", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "reduction", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x6e, 0x6f, 0x6e, 0x65}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_negative_log_likelihood_loss_input_shape_is_NC", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "input", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "target", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "loss", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestNegativeLogLikelihoodLossInputShapeIsNC version: 6. +func NewTestNegativeLogLikelihoodLossInputShapeIsNC() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "NegativeLogLikelihoodLoss", + Title: "TestNegativeLogLikelihoodLossInputShapeIsNC", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xc0, 0x1, 0xa, 0x46, 0xa, 0x5, 0x69, 0x6e, 0x70, 0x75, 0x74, 0xa, 0x6, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x4, 0x6c, 0x6f, 0x73, 0x73, 0x22, 0x19, 0x4e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x4c, 0x6f, 0x67, 0x4c, 0x69, 0x6b, 0x65, 0x6c, 0x69, 0x68, 0x6f, 0x6f, 0x64, 0x4c, 0x6f, 0x73, 0x73, 0x2a, 0x14, 0xa, 0x9, 0x72, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4, 0x6e, 0x6f, 0x6e, 0x65, 0xa0, 0x1, 0x3, 0x12, 0x33, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x69, 0x6b, 0x65, 0x6c, 0x69, 0x68, 0x6f, 0x6f, 0x64, 0x5f, 0x6c, 0x6f, 0x73, 0x73, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x69, 0x73, 0x5f, 0x4e, 0x43, 0x5a, 0x17, 0xa, 0x5, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x5, 0x5a, 0x14, 0xa, 0x6, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0xa, 0xa, 0x8, 0x8, 0x6, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0x12, 0xa, 0x4, 0x6c, 0x6f, 0x73, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"input", "target"}, + Output: []string{"loss"}, + Name: "", + OpType: "NegativeLogLikelihoodLoss", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0001e6700)(name:"reduction" type:STRING s:"none" ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 5), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056}), + ), + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]int32{1, 4, 3}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]float32{-0.71518934, -0.3834415, -0.92559665}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NC_test.go b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NC_test.go new file mode 100644 index 00000000..6ab97b00 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NC_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestNegativeLogLikelihoodLossInputShapeIsNC(t *testing.T) { + mytest := NewTestNegativeLogLikelihoodLossInputShapeIsNC() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2.go b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2.go new file mode 100644 index 00000000..48a3a9e6 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2.go @@ -0,0 +1,202 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("NegativeLogLikelihoodLoss", "TestNegativeLogLikelihoodLossInputShapeIsNCd1d2", NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"input", "target"}, + Output: {"loss"}, + Name: "", + OpType: "NegativeLogLikelihoodLoss", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "reduction", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x6e, 0x6f, 0x6e, 0x65}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_negative_log_likelihood_loss_input_shape_is_NCd1d2", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "input", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "target", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "loss", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2 version: 6. +func NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "NegativeLogLikelihoodLoss", + Title: "TestNegativeLogLikelihoodLossInputShapeIsNCd1d2", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xdc, 0x1, 0xa, 0x46, 0xa, 0x5, 0x69, 0x6e, 0x70, 0x75, 0x74, 0xa, 0x6, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x4, 0x6c, 0x6f, 0x73, 0x73, 0x22, 0x19, 0x4e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x4c, 0x6f, 0x67, 0x4c, 0x69, 0x6b, 0x65, 0x6c, 0x69, 0x68, 0x6f, 0x6f, 0x64, 0x4c, 0x6f, 0x73, 0x73, 0x2a, 0x14, 0xa, 0x9, 0x72, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4, 0x6e, 0x6f, 0x6e, 0x65, 0xa0, 0x1, 0x3, 0x12, 0x37, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x69, 0x6b, 0x65, 0x6c, 0x69, 0x68, 0x6f, 0x6f, 0x64, 0x5f, 0x6c, 0x6f, 0x73, 0x73, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x69, 0x73, 0x5f, 0x4e, 0x43, 0x64, 0x31, 0x64, 0x32, 0x5a, 0x1f, 0xa, 0x5, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x5, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x6, 0x5a, 0x1c, 0xa, 0x6, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x6, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x6, 0x62, 0x1a, 0xa, 0x4, 0x6c, 0x6f, 0x73, 0x73, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x6, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"input", "target"}, + Output: []string{"loss"}, + Name: "", + OpType: "NegativeLogLikelihoodLoss", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217300)(name:"reduction" type:STRING s:"none" ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 5, 6, 6), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256, 0.15896958, 0.11037514, 0.6563296, 0.13818295, 0.19658236, 0.36872518, 0.82099324, 0.09710128, 0.8379449, 0.09609841, 0.97645944, 0.4686512, 0.9767611, 0.6048455, 0.7392636, 0.039187793, 0.28280696, 0.12019656, 0.2961402, 0.11872772, 0.31798318, 0.41426298, 0.064147495, 0.6924721, 0.56660146, 0.2653895, 0.5232481, 0.09394051, 0.5759465, 0.9292962, 0.31856894, 0.6674104, 0.13179787, 0.7163272, 0.2894061, 0.18319136, 0.5865129, 0.020107547, 0.82894003, 0.004695476, 0.6778165, 0.27000797, 0.735194, 0.96218854, 0.24875315, 0.57615733, 0.5920419, 0.5722519, 0.22308163, 0.952749, 0.44712538, 0.84640867, 0.6994793, 0.29743695, 0.81379783, 0.39650574, 0.8811032, 0.5812729, 0.8817354, 0.6925316, 0.7252543, 0.50132436, 0.95608366, 0.6439902, 0.42385504, 0.6063932, 0.019193199, 0.30157483, 0.66017354, 0.2900776, 0.6180154, 0.4287687, 0.13547407, 0.29828233, 0.5699649, 0.59087276, 0.57432526, 0.6532008, 0.65210325, 0.43141845, 0.8965466, 0.36756188, 0.43586493, 0.89192337, 0.806194, 0.7038886, 0.10022689, 0.9194826, 0.7142413, 0.998847, 0.1494483, 0.86812603, 0.16249293, 0.6155596, 0.123819984, 0.8480082, 0.807319, 0.56910074, 0.4071833, 0.069166996, 0.69742876, 0.45354268, 0.7220556, 0.8663823, 0.9755215, 0.8558034, 0.011714084, 0.35997805, 0.72999054, 0.17162968, 0.5210366, 0.05433799, 0.19999653, 0.018521795, 0.7936977, 0.22392468, 0.34535167, 0.9280813, 0.7044144, 0.03183893, 0.16469416, 0.6214784, 0.5772286, 0.23789282, 0.934214, 0.6139659, 0.5356328, 0.58991, 0.730122, 0.311945, 0.39822108, 0.20984375, 0.186193, 0.9443724, 0.73955077, 0.49045882, 0.22741462, 0.25435647, 0.05802916, 0.43441662, 0.3117959, 0.6963435, 0.37775183, 0.17960368, 0.024678728, 0.06724963, 0.67939276, 0.45369685, 0.5365792, 0.8966713, 0.9903389, 0.21689698, 0.6630782, 0.26332238, 0.020651, 0.7583786, 0.32001716, 0.3834639, 0.5883171, 0.8310484, 0.6289818, 0.8726507, 0.27354205, 0.7980468, 0.18563594, 0.95279163, 0.68748826, 0.21550767, 0.9473706, 0.7308558, 0.25394166, 0.21331197, 0.5182007, 0.025662718, 0.20747007, 0.42468548, 0.37416998, 0.46357542, 0.27762872, 0.58678436, 0.8638556, 0.11753186, 0.5173791, 0.13206811, 0.7168597, 0.3960597, 0.5654213, 0.18327984, 0.14484777, 0.48805627, 0.35561273, 0.94043195, 0.76532525, 0.7486636, 0.9037197, 0.08342244, 0.55219245, 0.58447605, 0.96193635, 0.29214752, 0.24082878, 0.10029394, 0.01642963, 0.9295293, 0.66991657, 0.7851529, 0.28173012, 0.58641016, 0.06395527, 0.4856276, 0.97749513, 0.87650526, 0.33815897, 0.96157014, 0.23170163, 0.9493188, 0.9413777, 0.79920256, 0.6304479, 0.87428796, 0.29302028, 0.84894353, 0.6178767, 0.013236858, 0.3472335, 0.14814086, 0.9818294, 0.4783703, 0.49739137, 0.63947254, 0.3685846, 0.13690028, 0.82211775, 0.18984792, 0.511319, 0.22431703, 0.09784448, 0.8621915, 0.97291946, 0.9608347, 0.9065555, 0.7740473, 0.33314514, 0.08110139, 0.40724117, 0.23223414, 0.13248764, 0.053427182, 0.72559434, 0.011427458, 0.77058077, 0.14694664, 0.07952208, 0.08960304, 0.6720478, 0.24536721, 0.42053947, 0.5573688, 0.8605512, 0.7270443, 0.2703279, 0.1314828, 0.05537432, 0.30159864, 0.26211816, 0.45614058, 0.68328136, 0.6956254, 0.28351885, 0.37992695, 0.18115096, 0.7885455, 0.056848075, 0.6969972, 0.7786954, 0.7774076, 0.25942257, 0.37381315, 0.58759964, 0.2728219, 0.3708528, 0.19705428, 0.45985588, 0.0446123, 0.79979587, 0.07695644, 0.5188351, 0.3068101, 0.57754296, 0.9594333, 0.6455702, 0.035362437, 0.43040243, 0.51001686, 0.5361775, 0.6813925, 0.2775961, 0.12886056, 0.39267567, 0.9564057, 0.1871309, 0.90398395, 0.54380596, 0.4569114, 0.8820414, 0.45860395, 0.72416764, 0.39902532, 0.9040444, 0.69002503, 0.69962204, 0.3277204, 0.75677866, 0.6360611, 0.24002028, 0.16053882, 0.7963915, 0.9591666, 0.45813882, 0.59098417, 0.85772264, 0.45722345, 0.9518745, 0.5757512, 0.8207671, 0.9088437, 0.8155238, 0.15941447, 0.62889844, 0.39843425, 0.06271295, 0.42403224, 0.25868407, 0.8490383, 0.033304628, 0.9589827, 0.35536885, 0.3567069, 0.016328502, 0.18523233, 0.4012595, 0.9292914, 0.09961493, 0.94530153, 0.86948854, 0.4541624, 0.3267009, 0.23274413, 0.6144647, 0.03307459, 0.015606064, 0.42879573, 0.06807408, 0.251941, 0.22116092, 0.2531912, 0.13105524, 0.012036223, 0.1154843, 0.61848027, 0.9742562, 0.990345, 0.4090541, 0.16295442, 0.63876176, 0.49030533, 0.9894098, 0.065304205, 0.7832344, 0.2883985, 0.24141861, 0.66250455, 0.24606319, 0.6658591, 0.51730853, 0.42408898, 0.5546878, 0.28705153, 0.7065747, 0.41485688, 0.36054555, 0.8286569, 0.92496693, 0.04600731, 0.23262699, 0.34851936, 0.8149665, 0.98549145, 0.9689717, 0.90494835, 0.29655626, 0.99201125, 0.24942005, 0.10590615, 0.9509526, 0.23342025, 0.68976825, 0.05835636, 0.7307091, 0.8817202, 0.2724369, 0.3790569, 0.3742962, 0.74878824, 0.23780724, 0.1718531, 0.44929165, 0.3044684, 0.8391891, 0.23774183, 0.50238943, 0.9425836, 0.6339977, 0.8672894, 0.9402097, 0.75076485, 0.69957507, 0.96796554, 0.9944008, 0.45182168, 0.07086978, 0.29279402, 0.1523547, 0.41748637, 0.13128933, 0.6041178, 0.38280806, 0.89538586, 0.96779466, 0.5468849, 0.27482358, 0.59223044, 0.8967612, 0.40673333, 0.55207825, 0.27165276, 0.45544416, 0.40171355, 0.24841346, 0.5058664, 0.31038082, 0.37303486, 0.5249705, 0.75059503, 0.33350748, 0.92415875, 0.8623186, 0.048690297, 0.25364253, 0.44613552, 0.10462789, 0.348476, 0.7400975, 0.68051445, 0.6223844, 0.7105284, 0.20492369, 0.3416981, 0.6762425, 0.8792348, 0.54367805, 0.28269964, 0.030235259, 0.7103368, 0.007884104, 0.37267908, 0.5305372, 0.92211145, 0.08949455, 0.40594232, 0.0243132, 0.34261099, 0.62223107, 0.27906793, 0.20974995, 0.11570323, 0.5771403, 0.69527, 0.67195714, 0.948861}), + ), + + tensor.New( + tensor.WithShape(3, 6, 6), + tensor.WithBacking([]int32{1, 4, 0, 0, 2, 3, 1, 0, 0, 0, 0, 2, 4, 0, 2, 3, 4, 3, 4, 4, 4, 2, 1, 3, 4, 4, 0, 0, 2, 4, 3, 3, 0, 0, 1, 4, 4, 0, 0, 0, 1, 1, 1, 4, 1, 4, 0, 4, 3, 2, 0, 3, 2, 3, 2, 2, 1, 3, 3, 0, 4, 3, 3, 0, 0, 1, 4, 4, 1, 0, 0, 0, 3, 4, 4, 2, 2, 3, 3, 4, 2, 1, 0, 4, 1, 3, 0, 3, 2, 1, 0, 0, 3, 4, 1, 0, 0, 2, 1, 1, 0, 1, 1, 0, 0, 3, 3, 3}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 6, 6), + tensor.WithBacking([]float32{-0.6120957, -0.7038886, -0.60276335, -0.5448832, -0.28280696, -0.29743695, -0.6976312, -0.891773, -0.96366274, -0.3834415, -0.79172504, -0.6924721, -0.807319, -0.92559665, -0.5232481, -0.6439902, -0.69742876, -0.6063932, -0.7220556, -0.8663823, -0.9755215, -0.7163272, -0.46631077, -0.4287687, -0.72999054, -0.17162968, -0.14335328, -0.9446689, -0.6778165, -0.018521795, -0.65210325, -0.43141845, -0.45615032, -0.56843394, -0.97645944, -0.03183893, -0.26211816, -0.6214784, -0.5772286, -0.23789282, -0.6289818, -0.8726507, -0.27354205, -0.7885455, -0.18563594, -0.6969972, -0.39822108, -0.7774076, -0.9065555, -0.7851529, -0.73955077, -0.08110139, -0.06395527, -0.23223414, -0.97749513, -0.87650526, -0.37416998, -0.011427458, -0.77058077, -0.17960368, -0.57754296, -0.08960304, -0.6720478, -0.45369685, -0.5365792, -0.3960597, -0.5361775, -0.6813925, -0.14484777, -0.26332238, -0.020651, -0.7583786, -0.8391891, -0.92415875, -0.8623186, -0.42408898, -0.5546878, -0.8672894, -0.9402097, -0.348476, -0.36054555, -0.4541624, -0.69962204, -0.7105284, -0.6144647, -0.29279402, -0.24002028, -0.41748637, -0.9689717, -0.251941, -0.45813882, -0.59098417, -0.96779466, -0.37267908, -0.1154843, -0.5757512, -0.8207671, -0.05835636, -0.4090541, -0.16295442, -0.62889844, -0.49030533, -0.9894098, -0.42403224, -0.25868407, -0.37303486, -0.5249705, -0.75059503}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_reduction_mean.go b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_reduction_mean.go new file mode 100644 index 00000000..8b6149e9 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_reduction_mean.go @@ -0,0 +1,187 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("NegativeLogLikelihoodLoss", "TestNegativeLogLikelihoodLossInputShapeIsNCd1d2ReductionMean", NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2ReductionMean) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"input", "target"}, + Output: {"loss"}, + Name: "", + OpType: "NegativeLogLikelihoodLoss", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "reduction", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x6d, 0x65, 0x61, 0x6e}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_negative_log_likelihood_loss_input_shape_is_NCd1d2_reduction_mean", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "input", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "target", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "loss", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2ReductionMean version: 6. +func NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2ReductionMean() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "NegativeLogLikelihoodLoss", + Title: "TestNegativeLogLikelihoodLossInputShapeIsNCd1d2ReductionMean", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xdf, 0x1, 0xa, 0x46, 0xa, 0x5, 0x69, 0x6e, 0x70, 0x75, 0x74, 0xa, 0x6, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x4, 0x6c, 0x6f, 0x73, 0x73, 0x22, 0x19, 0x4e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x4c, 0x6f, 0x67, 0x4c, 0x69, 0x6b, 0x65, 0x6c, 0x69, 0x68, 0x6f, 0x6f, 0x64, 0x4c, 0x6f, 0x73, 0x73, 0x2a, 0x14, 0xa, 0x9, 0x72, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4, 0x6d, 0x65, 0x61, 0x6e, 0xa0, 0x1, 0x3, 0x12, 0x46, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x69, 0x6b, 0x65, 0x6c, 0x69, 0x68, 0x6f, 0x6f, 0x64, 0x5f, 0x6c, 0x6f, 0x73, 0x73, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x69, 0x73, 0x5f, 0x4e, 0x43, 0x64, 0x31, 0x64, 0x32, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x61, 0x6e, 0x5a, 0x1f, 0xa, 0x5, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x5, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x6, 0x5a, 0x1c, 0xa, 0x6, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x6, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x6, 0x62, 0xe, 0xa, 0x4, 0x6c, 0x6f, 0x73, 0x73, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"input", "target"}, + Output: []string{"loss"}, + Name: "", + OpType: "NegativeLogLikelihoodLoss", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000216b00)(name:"reduction" type:STRING s:"mean" ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 5, 6, 6), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256, 0.15896958, 0.11037514, 0.6563296, 0.13818295, 0.19658236, 0.36872518, 0.82099324, 0.09710128, 0.8379449, 0.09609841, 0.97645944, 0.4686512, 0.9767611, 0.6048455, 0.7392636, 0.039187793, 0.28280696, 0.12019656, 0.2961402, 0.11872772, 0.31798318, 0.41426298, 0.064147495, 0.6924721, 0.56660146, 0.2653895, 0.5232481, 0.09394051, 0.5759465, 0.9292962, 0.31856894, 0.6674104, 0.13179787, 0.7163272, 0.2894061, 0.18319136, 0.5865129, 0.020107547, 0.82894003, 0.004695476, 0.6778165, 0.27000797, 0.735194, 0.96218854, 0.24875315, 0.57615733, 0.5920419, 0.5722519, 0.22308163, 0.952749, 0.44712538, 0.84640867, 0.6994793, 0.29743695, 0.81379783, 0.39650574, 0.8811032, 0.5812729, 0.8817354, 0.6925316, 0.7252543, 0.50132436, 0.95608366, 0.6439902, 0.42385504, 0.6063932, 0.019193199, 0.30157483, 0.66017354, 0.2900776, 0.6180154, 0.4287687, 0.13547407, 0.29828233, 0.5699649, 0.59087276, 0.57432526, 0.6532008, 0.65210325, 0.43141845, 0.8965466, 0.36756188, 0.43586493, 0.89192337, 0.806194, 0.7038886, 0.10022689, 0.9194826, 0.7142413, 0.998847, 0.1494483, 0.86812603, 0.16249293, 0.6155596, 0.123819984, 0.8480082, 0.807319, 0.56910074, 0.4071833, 0.069166996, 0.69742876, 0.45354268, 0.7220556, 0.8663823, 0.9755215, 0.8558034, 0.011714084, 0.35997805, 0.72999054, 0.17162968, 0.5210366, 0.05433799, 0.19999653, 0.018521795, 0.7936977, 0.22392468, 0.34535167, 0.9280813, 0.7044144, 0.03183893, 0.16469416, 0.6214784, 0.5772286, 0.23789282, 0.934214, 0.6139659, 0.5356328, 0.58991, 0.730122, 0.311945, 0.39822108, 0.20984375, 0.186193, 0.9443724, 0.73955077, 0.49045882, 0.22741462, 0.25435647, 0.05802916, 0.43441662, 0.3117959, 0.6963435, 0.37775183, 0.17960368, 0.024678728, 0.06724963, 0.67939276, 0.45369685, 0.5365792, 0.8966713, 0.9903389, 0.21689698, 0.6630782, 0.26332238, 0.020651, 0.7583786, 0.32001716, 0.3834639, 0.5883171, 0.8310484, 0.6289818, 0.8726507, 0.27354205, 0.7980468, 0.18563594, 0.95279163, 0.68748826, 0.21550767, 0.9473706, 0.7308558, 0.25394166, 0.21331197, 0.5182007, 0.025662718, 0.20747007, 0.42468548, 0.37416998, 0.46357542, 0.27762872, 0.58678436, 0.8638556, 0.11753186, 0.5173791, 0.13206811, 0.7168597, 0.3960597, 0.5654213, 0.18327984, 0.14484777, 0.48805627, 0.35561273, 0.94043195, 0.76532525, 0.7486636, 0.9037197, 0.08342244, 0.55219245, 0.58447605, 0.96193635, 0.29214752, 0.24082878, 0.10029394, 0.01642963, 0.9295293, 0.66991657, 0.7851529, 0.28173012, 0.58641016, 0.06395527, 0.4856276, 0.97749513, 0.87650526, 0.33815897, 0.96157014, 0.23170163, 0.9493188, 0.9413777, 0.79920256, 0.6304479, 0.87428796, 0.29302028, 0.84894353, 0.6178767, 0.013236858, 0.3472335, 0.14814086, 0.9818294, 0.4783703, 0.49739137, 0.63947254, 0.3685846, 0.13690028, 0.82211775, 0.18984792, 0.511319, 0.22431703, 0.09784448, 0.8621915, 0.97291946, 0.9608347, 0.9065555, 0.7740473, 0.33314514, 0.08110139, 0.40724117, 0.23223414, 0.13248764, 0.053427182, 0.72559434, 0.011427458, 0.77058077, 0.14694664, 0.07952208, 0.08960304, 0.6720478, 0.24536721, 0.42053947, 0.5573688, 0.8605512, 0.7270443, 0.2703279, 0.1314828, 0.05537432, 0.30159864, 0.26211816, 0.45614058, 0.68328136, 0.6956254, 0.28351885, 0.37992695, 0.18115096, 0.7885455, 0.056848075, 0.6969972, 0.7786954, 0.7774076, 0.25942257, 0.37381315, 0.58759964, 0.2728219, 0.3708528, 0.19705428, 0.45985588, 0.0446123, 0.79979587, 0.07695644, 0.5188351, 0.3068101, 0.57754296, 0.9594333, 0.6455702, 0.035362437, 0.43040243, 0.51001686, 0.5361775, 0.6813925, 0.2775961, 0.12886056, 0.39267567, 0.9564057, 0.1871309, 0.90398395, 0.54380596, 0.4569114, 0.8820414, 0.45860395, 0.72416764, 0.39902532, 0.9040444, 0.69002503, 0.69962204, 0.3277204, 0.75677866, 0.6360611, 0.24002028, 0.16053882, 0.7963915, 0.9591666, 0.45813882, 0.59098417, 0.85772264, 0.45722345, 0.9518745, 0.5757512, 0.8207671, 0.9088437, 0.8155238, 0.15941447, 0.62889844, 0.39843425, 0.06271295, 0.42403224, 0.25868407, 0.8490383, 0.033304628, 0.9589827, 0.35536885, 0.3567069, 0.016328502, 0.18523233, 0.4012595, 0.9292914, 0.09961493, 0.94530153, 0.86948854, 0.4541624, 0.3267009, 0.23274413, 0.6144647, 0.03307459, 0.015606064, 0.42879573, 0.06807408, 0.251941, 0.22116092, 0.2531912, 0.13105524, 0.012036223, 0.1154843, 0.61848027, 0.9742562, 0.990345, 0.4090541, 0.16295442, 0.63876176, 0.49030533, 0.9894098, 0.065304205, 0.7832344, 0.2883985, 0.24141861, 0.66250455, 0.24606319, 0.6658591, 0.51730853, 0.42408898, 0.5546878, 0.28705153, 0.7065747, 0.41485688, 0.36054555, 0.8286569, 0.92496693, 0.04600731, 0.23262699, 0.34851936, 0.8149665, 0.98549145, 0.9689717, 0.90494835, 0.29655626, 0.99201125, 0.24942005, 0.10590615, 0.9509526, 0.23342025, 0.68976825, 0.05835636, 0.7307091, 0.8817202, 0.2724369, 0.3790569, 0.3742962, 0.74878824, 0.23780724, 0.1718531, 0.44929165, 0.3044684, 0.8391891, 0.23774183, 0.50238943, 0.9425836, 0.6339977, 0.8672894, 0.9402097, 0.75076485, 0.69957507, 0.96796554, 0.9944008, 0.45182168, 0.07086978, 0.29279402, 0.1523547, 0.41748637, 0.13128933, 0.6041178, 0.38280806, 0.89538586, 0.96779466, 0.5468849, 0.27482358, 0.59223044, 0.8967612, 0.40673333, 0.55207825, 0.27165276, 0.45544416, 0.40171355, 0.24841346, 0.5058664, 0.31038082, 0.37303486, 0.5249705, 0.75059503, 0.33350748, 0.92415875, 0.8623186, 0.048690297, 0.25364253, 0.44613552, 0.10462789, 0.348476, 0.7400975, 0.68051445, 0.6223844, 0.7105284, 0.20492369, 0.3416981, 0.6762425, 0.8792348, 0.54367805, 0.28269964, 0.030235259, 0.7103368, 0.007884104, 0.37267908, 0.5305372, 0.92211145, 0.08949455, 0.40594232, 0.0243132, 0.34261099, 0.62223107, 0.27906793, 0.20974995, 0.11570323, 0.5771403, 0.69527, 0.67195714, 0.948861}), + ), + + tensor.New( + tensor.WithShape(3, 6, 6), + tensor.WithBacking([]int32{1, 4, 0, 0, 2, 3, 1, 0, 0, 0, 0, 2, 4, 0, 2, 3, 4, 3, 4, 4, 4, 2, 1, 3, 4, 4, 0, 0, 2, 4, 3, 3, 0, 0, 1, 4, 4, 0, 0, 0, 1, 1, 1, 4, 1, 4, 0, 4, 3, 2, 0, 3, 2, 3, 2, 2, 1, 3, 3, 0, 4, 3, 3, 0, 0, 1, 4, 4, 1, 0, 0, 0, 3, 4, 4, 2, 2, 3, 3, 4, 2, 1, 0, 4, 1, 3, 0, 3, 2, 1, 0, 0, 3, 4, 1, 0, 0, 2, 1, 1, 0, 1, 1, 0, 0, 3, 3, 3}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{-0.5448008}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_reduction_mean_test.go b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_reduction_mean_test.go new file mode 100644 index 00000000..67998560 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_reduction_mean_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2ReductionMean(t *testing.T) { + mytest := NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2ReductionMean() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_reduction_sum.go b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_reduction_sum.go new file mode 100644 index 00000000..d23fa127 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_reduction_sum.go @@ -0,0 +1,187 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("NegativeLogLikelihoodLoss", "TestNegativeLogLikelihoodLossInputShapeIsNCd1d2ReductionSum", NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2ReductionSum) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"input", "target"}, + Output: {"loss"}, + Name: "", + OpType: "NegativeLogLikelihoodLoss", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "reduction", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x73, 0x75, 0x6d}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_negative_log_likelihood_loss_input_shape_is_NCd1d2_reduction_sum", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "input", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "target", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "loss", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2ReductionSum version: 6. +func NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2ReductionSum() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "NegativeLogLikelihoodLoss", + Title: "TestNegativeLogLikelihoodLossInputShapeIsNCd1d2ReductionSum", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xdd, 0x1, 0xa, 0x45, 0xa, 0x5, 0x69, 0x6e, 0x70, 0x75, 0x74, 0xa, 0x6, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x4, 0x6c, 0x6f, 0x73, 0x73, 0x22, 0x19, 0x4e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x4c, 0x6f, 0x67, 0x4c, 0x69, 0x6b, 0x65, 0x6c, 0x69, 0x68, 0x6f, 0x6f, 0x64, 0x4c, 0x6f, 0x73, 0x73, 0x2a, 0x13, 0xa, 0x9, 0x72, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3, 0x73, 0x75, 0x6d, 0xa0, 0x1, 0x3, 0x12, 0x45, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x69, 0x6b, 0x65, 0x6c, 0x69, 0x68, 0x6f, 0x6f, 0x64, 0x5f, 0x6c, 0x6f, 0x73, 0x73, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x69, 0x73, 0x5f, 0x4e, 0x43, 0x64, 0x31, 0x64, 0x32, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x75, 0x6d, 0x5a, 0x1f, 0xa, 0x5, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x5, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x6, 0x5a, 0x1c, 0xa, 0x6, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x6, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x6, 0x62, 0xe, 0xa, 0x4, 0x6c, 0x6f, 0x73, 0x73, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"input", "target"}, + Output: []string{"loss"}, + Name: "", + OpType: "NegativeLogLikelihoodLoss", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217600)(name:"reduction" type:STRING s:"sum" ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 5, 6, 6), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256, 0.15896958, 0.11037514, 0.6563296, 0.13818295, 0.19658236, 0.36872518, 0.82099324, 0.09710128, 0.8379449, 0.09609841, 0.97645944, 0.4686512, 0.9767611, 0.6048455, 0.7392636, 0.039187793, 0.28280696, 0.12019656, 0.2961402, 0.11872772, 0.31798318, 0.41426298, 0.064147495, 0.6924721, 0.56660146, 0.2653895, 0.5232481, 0.09394051, 0.5759465, 0.9292962, 0.31856894, 0.6674104, 0.13179787, 0.7163272, 0.2894061, 0.18319136, 0.5865129, 0.020107547, 0.82894003, 0.004695476, 0.6778165, 0.27000797, 0.735194, 0.96218854, 0.24875315, 0.57615733, 0.5920419, 0.5722519, 0.22308163, 0.952749, 0.44712538, 0.84640867, 0.6994793, 0.29743695, 0.81379783, 0.39650574, 0.8811032, 0.5812729, 0.8817354, 0.6925316, 0.7252543, 0.50132436, 0.95608366, 0.6439902, 0.42385504, 0.6063932, 0.019193199, 0.30157483, 0.66017354, 0.2900776, 0.6180154, 0.4287687, 0.13547407, 0.29828233, 0.5699649, 0.59087276, 0.57432526, 0.6532008, 0.65210325, 0.43141845, 0.8965466, 0.36756188, 0.43586493, 0.89192337, 0.806194, 0.7038886, 0.10022689, 0.9194826, 0.7142413, 0.998847, 0.1494483, 0.86812603, 0.16249293, 0.6155596, 0.123819984, 0.8480082, 0.807319, 0.56910074, 0.4071833, 0.069166996, 0.69742876, 0.45354268, 0.7220556, 0.8663823, 0.9755215, 0.8558034, 0.011714084, 0.35997805, 0.72999054, 0.17162968, 0.5210366, 0.05433799, 0.19999653, 0.018521795, 0.7936977, 0.22392468, 0.34535167, 0.9280813, 0.7044144, 0.03183893, 0.16469416, 0.6214784, 0.5772286, 0.23789282, 0.934214, 0.6139659, 0.5356328, 0.58991, 0.730122, 0.311945, 0.39822108, 0.20984375, 0.186193, 0.9443724, 0.73955077, 0.49045882, 0.22741462, 0.25435647, 0.05802916, 0.43441662, 0.3117959, 0.6963435, 0.37775183, 0.17960368, 0.024678728, 0.06724963, 0.67939276, 0.45369685, 0.5365792, 0.8966713, 0.9903389, 0.21689698, 0.6630782, 0.26332238, 0.020651, 0.7583786, 0.32001716, 0.3834639, 0.5883171, 0.8310484, 0.6289818, 0.8726507, 0.27354205, 0.7980468, 0.18563594, 0.95279163, 0.68748826, 0.21550767, 0.9473706, 0.7308558, 0.25394166, 0.21331197, 0.5182007, 0.025662718, 0.20747007, 0.42468548, 0.37416998, 0.46357542, 0.27762872, 0.58678436, 0.8638556, 0.11753186, 0.5173791, 0.13206811, 0.7168597, 0.3960597, 0.5654213, 0.18327984, 0.14484777, 0.48805627, 0.35561273, 0.94043195, 0.76532525, 0.7486636, 0.9037197, 0.08342244, 0.55219245, 0.58447605, 0.96193635, 0.29214752, 0.24082878, 0.10029394, 0.01642963, 0.9295293, 0.66991657, 0.7851529, 0.28173012, 0.58641016, 0.06395527, 0.4856276, 0.97749513, 0.87650526, 0.33815897, 0.96157014, 0.23170163, 0.9493188, 0.9413777, 0.79920256, 0.6304479, 0.87428796, 0.29302028, 0.84894353, 0.6178767, 0.013236858, 0.3472335, 0.14814086, 0.9818294, 0.4783703, 0.49739137, 0.63947254, 0.3685846, 0.13690028, 0.82211775, 0.18984792, 0.511319, 0.22431703, 0.09784448, 0.8621915, 0.97291946, 0.9608347, 0.9065555, 0.7740473, 0.33314514, 0.08110139, 0.40724117, 0.23223414, 0.13248764, 0.053427182, 0.72559434, 0.011427458, 0.77058077, 0.14694664, 0.07952208, 0.08960304, 0.6720478, 0.24536721, 0.42053947, 0.5573688, 0.8605512, 0.7270443, 0.2703279, 0.1314828, 0.05537432, 0.30159864, 0.26211816, 0.45614058, 0.68328136, 0.6956254, 0.28351885, 0.37992695, 0.18115096, 0.7885455, 0.056848075, 0.6969972, 0.7786954, 0.7774076, 0.25942257, 0.37381315, 0.58759964, 0.2728219, 0.3708528, 0.19705428, 0.45985588, 0.0446123, 0.79979587, 0.07695644, 0.5188351, 0.3068101, 0.57754296, 0.9594333, 0.6455702, 0.035362437, 0.43040243, 0.51001686, 0.5361775, 0.6813925, 0.2775961, 0.12886056, 0.39267567, 0.9564057, 0.1871309, 0.90398395, 0.54380596, 0.4569114, 0.8820414, 0.45860395, 0.72416764, 0.39902532, 0.9040444, 0.69002503, 0.69962204, 0.3277204, 0.75677866, 0.6360611, 0.24002028, 0.16053882, 0.7963915, 0.9591666, 0.45813882, 0.59098417, 0.85772264, 0.45722345, 0.9518745, 0.5757512, 0.8207671, 0.9088437, 0.8155238, 0.15941447, 0.62889844, 0.39843425, 0.06271295, 0.42403224, 0.25868407, 0.8490383, 0.033304628, 0.9589827, 0.35536885, 0.3567069, 0.016328502, 0.18523233, 0.4012595, 0.9292914, 0.09961493, 0.94530153, 0.86948854, 0.4541624, 0.3267009, 0.23274413, 0.6144647, 0.03307459, 0.015606064, 0.42879573, 0.06807408, 0.251941, 0.22116092, 0.2531912, 0.13105524, 0.012036223, 0.1154843, 0.61848027, 0.9742562, 0.990345, 0.4090541, 0.16295442, 0.63876176, 0.49030533, 0.9894098, 0.065304205, 0.7832344, 0.2883985, 0.24141861, 0.66250455, 0.24606319, 0.6658591, 0.51730853, 0.42408898, 0.5546878, 0.28705153, 0.7065747, 0.41485688, 0.36054555, 0.8286569, 0.92496693, 0.04600731, 0.23262699, 0.34851936, 0.8149665, 0.98549145, 0.9689717, 0.90494835, 0.29655626, 0.99201125, 0.24942005, 0.10590615, 0.9509526, 0.23342025, 0.68976825, 0.05835636, 0.7307091, 0.8817202, 0.2724369, 0.3790569, 0.3742962, 0.74878824, 0.23780724, 0.1718531, 0.44929165, 0.3044684, 0.8391891, 0.23774183, 0.50238943, 0.9425836, 0.6339977, 0.8672894, 0.9402097, 0.75076485, 0.69957507, 0.96796554, 0.9944008, 0.45182168, 0.07086978, 0.29279402, 0.1523547, 0.41748637, 0.13128933, 0.6041178, 0.38280806, 0.89538586, 0.96779466, 0.5468849, 0.27482358, 0.59223044, 0.8967612, 0.40673333, 0.55207825, 0.27165276, 0.45544416, 0.40171355, 0.24841346, 0.5058664, 0.31038082, 0.37303486, 0.5249705, 0.75059503, 0.33350748, 0.92415875, 0.8623186, 0.048690297, 0.25364253, 0.44613552, 0.10462789, 0.348476, 0.7400975, 0.68051445, 0.6223844, 0.7105284, 0.20492369, 0.3416981, 0.6762425, 0.8792348, 0.54367805, 0.28269964, 0.030235259, 0.7103368, 0.007884104, 0.37267908, 0.5305372, 0.92211145, 0.08949455, 0.40594232, 0.0243132, 0.34261099, 0.62223107, 0.27906793, 0.20974995, 0.11570323, 0.5771403, 0.69527, 0.67195714, 0.948861}), + ), + + tensor.New( + tensor.WithShape(3, 6, 6), + tensor.WithBacking([]int32{1, 4, 0, 0, 2, 3, 1, 0, 0, 0, 0, 2, 4, 0, 2, 3, 4, 3, 4, 4, 4, 2, 1, 3, 4, 4, 0, 0, 2, 4, 3, 3, 0, 0, 1, 4, 4, 0, 0, 0, 1, 1, 1, 4, 1, 4, 0, 4, 3, 2, 0, 3, 2, 3, 2, 2, 1, 3, 3, 0, 4, 3, 3, 0, 0, 1, 4, 4, 1, 0, 0, 0, 3, 4, 4, 2, 2, 3, 3, 4, 2, 1, 0, 4, 1, 3, 0, 3, 2, 1, 0, 0, 3, 4, 1, 0, 0, 2, 1, 1, 0, 1, 1, 0, 0, 3, 3, 3}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{-58.83849}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_reduction_sum_test.go b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_reduction_sum_test.go new file mode 100644 index 00000000..cb68ca36 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_reduction_sum_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2ReductionSum(t *testing.T) { + mytest := NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2ReductionSum() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_test.go b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_test.go new file mode 100644 index 00000000..9a0bfcb5 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2(t *testing.T) { + mytest := NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight.go b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight.go new file mode 100644 index 00000000..35d42d8e --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight.go @@ -0,0 +1,227 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("NegativeLogLikelihoodLoss", "TestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeight", NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeight) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"input", "target", "weight"}, + Output: {"loss"}, + Name: "", + OpType: "NegativeLogLikelihoodLoss", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "reduction", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x6e, 0x6f, 0x6e, 0x65}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "input", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "target", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "weight", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "loss", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeight version: 6. +func NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeight() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "NegativeLogLikelihoodLoss", + Title: "TestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeight", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x86, 0x2, 0xa, 0x4e, 0xa, 0x5, 0x69, 0x6e, 0x70, 0x75, 0x74, 0xa, 0x6, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0xa, 0x6, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x4, 0x6c, 0x6f, 0x73, 0x73, 0x22, 0x19, 0x4e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x4c, 0x6f, 0x67, 0x4c, 0x69, 0x6b, 0x65, 0x6c, 0x69, 0x68, 0x6f, 0x6f, 0x64, 0x4c, 0x6f, 0x73, 0x73, 0x2a, 0x14, 0xa, 0x9, 0x72, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4, 0x6e, 0x6f, 0x6e, 0x65, 0xa0, 0x1, 0x3, 0x12, 0x43, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x69, 0x6b, 0x65, 0x6c, 0x69, 0x68, 0x6f, 0x6f, 0x64, 0x5f, 0x6c, 0x6f, 0x73, 0x73, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x69, 0x73, 0x5f, 0x4e, 0x43, 0x64, 0x31, 0x64, 0x32, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5a, 0x1f, 0xa, 0x5, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x5, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x6, 0x5a, 0x1c, 0xa, 0x6, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x6, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x6, 0x5a, 0x14, 0xa, 0x6, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x1a, 0xa, 0x4, 0x6c, 0x6f, 0x73, 0x73, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x6, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"input", "target", "weight"}, + Output: []string{"loss"}, + Name: "", + OpType: "NegativeLogLikelihoodLoss", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000216c00)(name:"reduction" type:STRING s:"none" ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 5, 6, 6), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256, 0.15896958, 0.11037514, 0.6563296, 0.13818295, 0.19658236, 0.36872518, 0.82099324, 0.09710128, 0.8379449, 0.09609841, 0.97645944, 0.4686512, 0.9767611, 0.6048455, 0.7392636, 0.039187793, 0.28280696, 0.12019656, 0.2961402, 0.11872772, 0.31798318, 0.41426298, 0.064147495, 0.6924721, 0.56660146, 0.2653895, 0.5232481, 0.09394051, 0.5759465, 0.9292962, 0.31856894, 0.6674104, 0.13179787, 0.7163272, 0.2894061, 0.18319136, 0.5865129, 0.020107547, 0.82894003, 0.004695476, 0.6778165, 0.27000797, 0.735194, 0.96218854, 0.24875315, 0.57615733, 0.5920419, 0.5722519, 0.22308163, 0.952749, 0.44712538, 0.84640867, 0.6994793, 0.29743695, 0.81379783, 0.39650574, 0.8811032, 0.5812729, 0.8817354, 0.6925316, 0.7252543, 0.50132436, 0.95608366, 0.6439902, 0.42385504, 0.6063932, 0.019193199, 0.30157483, 0.66017354, 0.2900776, 0.6180154, 0.4287687, 0.13547407, 0.29828233, 0.5699649, 0.59087276, 0.57432526, 0.6532008, 0.65210325, 0.43141845, 0.8965466, 0.36756188, 0.43586493, 0.89192337, 0.806194, 0.7038886, 0.10022689, 0.9194826, 0.7142413, 0.998847, 0.1494483, 0.86812603, 0.16249293, 0.6155596, 0.123819984, 0.8480082, 0.807319, 0.56910074, 0.4071833, 0.069166996, 0.69742876, 0.45354268, 0.7220556, 0.8663823, 0.9755215, 0.8558034, 0.011714084, 0.35997805, 0.72999054, 0.17162968, 0.5210366, 0.05433799, 0.19999653, 0.018521795, 0.7936977, 0.22392468, 0.34535167, 0.9280813, 0.7044144, 0.03183893, 0.16469416, 0.6214784, 0.5772286, 0.23789282, 0.934214, 0.6139659, 0.5356328, 0.58991, 0.730122, 0.311945, 0.39822108, 0.20984375, 0.186193, 0.9443724, 0.73955077, 0.49045882, 0.22741462, 0.25435647, 0.05802916, 0.43441662, 0.3117959, 0.6963435, 0.37775183, 0.17960368, 0.024678728, 0.06724963, 0.67939276, 0.45369685, 0.5365792, 0.8966713, 0.9903389, 0.21689698, 0.6630782, 0.26332238, 0.020651, 0.7583786, 0.32001716, 0.3834639, 0.5883171, 0.8310484, 0.6289818, 0.8726507, 0.27354205, 0.7980468, 0.18563594, 0.95279163, 0.68748826, 0.21550767, 0.9473706, 0.7308558, 0.25394166, 0.21331197, 0.5182007, 0.025662718, 0.20747007, 0.42468548, 0.37416998, 0.46357542, 0.27762872, 0.58678436, 0.8638556, 0.11753186, 0.5173791, 0.13206811, 0.7168597, 0.3960597, 0.5654213, 0.18327984, 0.14484777, 0.48805627, 0.35561273, 0.94043195, 0.76532525, 0.7486636, 0.9037197, 0.08342244, 0.55219245, 0.58447605, 0.96193635, 0.29214752, 0.24082878, 0.10029394, 0.01642963, 0.9295293, 0.66991657, 0.7851529, 0.28173012, 0.58641016, 0.06395527, 0.4856276, 0.97749513, 0.87650526, 0.33815897, 0.96157014, 0.23170163, 0.9493188, 0.9413777, 0.79920256, 0.6304479, 0.87428796, 0.29302028, 0.84894353, 0.6178767, 0.013236858, 0.3472335, 0.14814086, 0.9818294, 0.4783703, 0.49739137, 0.63947254, 0.3685846, 0.13690028, 0.82211775, 0.18984792, 0.511319, 0.22431703, 0.09784448, 0.8621915, 0.97291946, 0.9608347, 0.9065555, 0.7740473, 0.33314514, 0.08110139, 0.40724117, 0.23223414, 0.13248764, 0.053427182, 0.72559434, 0.011427458, 0.77058077, 0.14694664, 0.07952208, 0.08960304, 0.6720478, 0.24536721, 0.42053947, 0.5573688, 0.8605512, 0.7270443, 0.2703279, 0.1314828, 0.05537432, 0.30159864, 0.26211816, 0.45614058, 0.68328136, 0.6956254, 0.28351885, 0.37992695, 0.18115096, 0.7885455, 0.056848075, 0.6969972, 0.7786954, 0.7774076, 0.25942257, 0.37381315, 0.58759964, 0.2728219, 0.3708528, 0.19705428, 0.45985588, 0.0446123, 0.79979587, 0.07695644, 0.5188351, 0.3068101, 0.57754296, 0.9594333, 0.6455702, 0.035362437, 0.43040243, 0.51001686, 0.5361775, 0.6813925, 0.2775961, 0.12886056, 0.39267567, 0.9564057, 0.1871309, 0.90398395, 0.54380596, 0.4569114, 0.8820414, 0.45860395, 0.72416764, 0.39902532, 0.9040444, 0.69002503, 0.69962204, 0.3277204, 0.75677866, 0.6360611, 0.24002028, 0.16053882, 0.7963915, 0.9591666, 0.45813882, 0.59098417, 0.85772264, 0.45722345, 0.9518745, 0.5757512, 0.8207671, 0.9088437, 0.8155238, 0.15941447, 0.62889844, 0.39843425, 0.06271295, 0.42403224, 0.25868407, 0.8490383, 0.033304628, 0.9589827, 0.35536885, 0.3567069, 0.016328502, 0.18523233, 0.4012595, 0.9292914, 0.09961493, 0.94530153, 0.86948854, 0.4541624, 0.3267009, 0.23274413, 0.6144647, 0.03307459, 0.015606064, 0.42879573, 0.06807408, 0.251941, 0.22116092, 0.2531912, 0.13105524, 0.012036223, 0.1154843, 0.61848027, 0.9742562, 0.990345, 0.4090541, 0.16295442, 0.63876176, 0.49030533, 0.9894098, 0.065304205, 0.7832344, 0.2883985, 0.24141861, 0.66250455, 0.24606319, 0.6658591, 0.51730853, 0.42408898, 0.5546878, 0.28705153, 0.7065747, 0.41485688, 0.36054555, 0.8286569, 0.92496693, 0.04600731, 0.23262699, 0.34851936, 0.8149665, 0.98549145, 0.9689717, 0.90494835, 0.29655626, 0.99201125, 0.24942005, 0.10590615, 0.9509526, 0.23342025, 0.68976825, 0.05835636, 0.7307091, 0.8817202, 0.2724369, 0.3790569, 0.3742962, 0.74878824, 0.23780724, 0.1718531, 0.44929165, 0.3044684, 0.8391891, 0.23774183, 0.50238943, 0.9425836, 0.6339977, 0.8672894, 0.9402097, 0.75076485, 0.69957507, 0.96796554, 0.9944008, 0.45182168, 0.07086978, 0.29279402, 0.1523547, 0.41748637, 0.13128933, 0.6041178, 0.38280806, 0.89538586, 0.96779466, 0.5468849, 0.27482358, 0.59223044, 0.8967612, 0.40673333, 0.55207825, 0.27165276, 0.45544416, 0.40171355, 0.24841346, 0.5058664, 0.31038082, 0.37303486, 0.5249705, 0.75059503, 0.33350748, 0.92415875, 0.8623186, 0.048690297, 0.25364253, 0.44613552, 0.10462789, 0.348476, 0.7400975, 0.68051445, 0.6223844, 0.7105284, 0.20492369, 0.3416981, 0.6762425, 0.8792348, 0.54367805, 0.28269964, 0.030235259, 0.7103368, 0.007884104, 0.37267908, 0.5305372, 0.92211145, 0.08949455, 0.40594232, 0.0243132, 0.34261099, 0.62223107, 0.27906793, 0.20974995, 0.11570323, 0.5771403, 0.69527, 0.67195714, 0.948861}), + ), + + tensor.New( + tensor.WithShape(3, 6, 6), + tensor.WithBacking([]int32{1, 4, 0, 0, 2, 3, 1, 0, 0, 0, 0, 2, 4, 0, 2, 3, 4, 3, 4, 4, 4, 2, 1, 3, 4, 4, 0, 0, 2, 4, 3, 3, 0, 0, 1, 4, 4, 0, 0, 0, 1, 1, 1, 4, 1, 4, 0, 4, 3, 2, 0, 3, 2, 3, 2, 2, 1, 3, 3, 0, 4, 3, 3, 0, 0, 1, 4, 4, 1, 0, 0, 0, 3, 4, 4, 2, 2, 3, 3, 4, 2, 1, 0, 4, 1, 3, 0, 3, 2, 1, 0, 0, 3, 4, 1, 0, 0, 2, 1, 1, 0, 1, 1, 0, 0, 3, 3, 3}), + ), + + tensor.New( + tensor.WithShape(5), + tensor.WithBacking([]float32{0.5834042, 0.9364681, 0.94078165, 0.052508168, 0.59621114}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 6, 6), + tensor.WithBacking([]float32{-0.57320815, -0.41966623, -0.35165465, -0.31788713, -0.2660596, -0.01561787, -0.65330935, -0.5202641, -0.5622049, -0.22370137, -0.4618957, -0.65146506, -0.48133257, -0.539997, -0.49226218, -0.033814747, -0.4158148, -0.031840596, -0.4304976, -0.5165468, -0.58161676, -0.67390746, -0.43668517, -0.022513859, -0.4352285, -0.102327526, -0.08363291, -0.5511238, -0.6376773, -0.0110429, -0.034240745, -0.022652993, -0.26612002, -0.33162674, -0.91442317, -0.018982725, -0.15627776, -0.3625731, -0.33675757, -0.13878767, -0.58902144, -0.81720954, -0.25616342, -0.4701396, -0.17384215, -0.4155575, -0.23232384, -0.46349907, -0.047601566, -0.7386575, -0.431457, -0.0042584855, -0.060167946, -0.012194189, -0.9196095, -0.82460004, -0.35039824, -0.0006000349, -0.040461786, -0.10478154, -0.34433755, -0.0047048912, -0.035288, -0.26468864, -0.31304255, -0.37089726, -0.319675, -0.40625378, -0.13564532, -0.15362339, -0.012047879, -0.44244125, -0.044064283, -0.55099374, -0.5141239, -0.39897513, -0.5218401, -0.045539778, -0.049368687, -0.20776527, -0.33919463, -0.42530861, -0.40816242, -0.42362493, -0.5754266, -0.0153740775, -0.14002883, -0.021921445, -0.9115908, -0.2359347, -0.2672801, -0.34478262, -0.050817125, -0.22219542, -0.10814736, -0.33589566, -0.47883895, -0.054900594, -0.38306612, -0.15260161, -0.366902, -0.45915532, -0.92655075, -0.24738218, -0.15091737, -0.019587377, -0.027565237, -0.03941237}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight_reduction_mean.go b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight_reduction_mean.go new file mode 100644 index 00000000..57afeee8 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight_reduction_mean.go @@ -0,0 +1,212 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("NegativeLogLikelihoodLoss", "TestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeightReductionMean", NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeightReductionMean) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"input", "target", "weight"}, + Output: {"loss"}, + Name: "", + OpType: "NegativeLogLikelihoodLoss", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "reduction", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x6d, 0x65, 0x61, 0x6e}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight_reduction_mean", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "input", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "target", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "weight", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "loss", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeightReductionMean version: 6. +func NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeightReductionMean() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "NegativeLogLikelihoodLoss", + Title: "TestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeightReductionMean", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x89, 0x2, 0xa, 0x4e, 0xa, 0x5, 0x69, 0x6e, 0x70, 0x75, 0x74, 0xa, 0x6, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0xa, 0x6, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x4, 0x6c, 0x6f, 0x73, 0x73, 0x22, 0x19, 0x4e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x4c, 0x6f, 0x67, 0x4c, 0x69, 0x6b, 0x65, 0x6c, 0x69, 0x68, 0x6f, 0x6f, 0x64, 0x4c, 0x6f, 0x73, 0x73, 0x2a, 0x14, 0xa, 0x9, 0x72, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4, 0x6d, 0x65, 0x61, 0x6e, 0xa0, 0x1, 0x3, 0x12, 0x52, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x69, 0x6b, 0x65, 0x6c, 0x69, 0x68, 0x6f, 0x6f, 0x64, 0x5f, 0x6c, 0x6f, 0x73, 0x73, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x69, 0x73, 0x5f, 0x4e, 0x43, 0x64, 0x31, 0x64, 0x32, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x61, 0x6e, 0x5a, 0x1f, 0xa, 0x5, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x5, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x6, 0x5a, 0x1c, 0xa, 0x6, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x6, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x6, 0x5a, 0x14, 0xa, 0x6, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0xe, 0xa, 0x4, 0x6c, 0x6f, 0x73, 0x73, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"input", "target", "weight"}, + Output: []string{"loss"}, + Name: "", + OpType: "NegativeLogLikelihoodLoss", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0001e6100)(name:"reduction" type:STRING s:"mean" ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 5, 6, 6), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256, 0.15896958, 0.11037514, 0.6563296, 0.13818295, 0.19658236, 0.36872518, 0.82099324, 0.09710128, 0.8379449, 0.09609841, 0.97645944, 0.4686512, 0.9767611, 0.6048455, 0.7392636, 0.039187793, 0.28280696, 0.12019656, 0.2961402, 0.11872772, 0.31798318, 0.41426298, 0.064147495, 0.6924721, 0.56660146, 0.2653895, 0.5232481, 0.09394051, 0.5759465, 0.9292962, 0.31856894, 0.6674104, 0.13179787, 0.7163272, 0.2894061, 0.18319136, 0.5865129, 0.020107547, 0.82894003, 0.004695476, 0.6778165, 0.27000797, 0.735194, 0.96218854, 0.24875315, 0.57615733, 0.5920419, 0.5722519, 0.22308163, 0.952749, 0.44712538, 0.84640867, 0.6994793, 0.29743695, 0.81379783, 0.39650574, 0.8811032, 0.5812729, 0.8817354, 0.6925316, 0.7252543, 0.50132436, 0.95608366, 0.6439902, 0.42385504, 0.6063932, 0.019193199, 0.30157483, 0.66017354, 0.2900776, 0.6180154, 0.4287687, 0.13547407, 0.29828233, 0.5699649, 0.59087276, 0.57432526, 0.6532008, 0.65210325, 0.43141845, 0.8965466, 0.36756188, 0.43586493, 0.89192337, 0.806194, 0.7038886, 0.10022689, 0.9194826, 0.7142413, 0.998847, 0.1494483, 0.86812603, 0.16249293, 0.6155596, 0.123819984, 0.8480082, 0.807319, 0.56910074, 0.4071833, 0.069166996, 0.69742876, 0.45354268, 0.7220556, 0.8663823, 0.9755215, 0.8558034, 0.011714084, 0.35997805, 0.72999054, 0.17162968, 0.5210366, 0.05433799, 0.19999653, 0.018521795, 0.7936977, 0.22392468, 0.34535167, 0.9280813, 0.7044144, 0.03183893, 0.16469416, 0.6214784, 0.5772286, 0.23789282, 0.934214, 0.6139659, 0.5356328, 0.58991, 0.730122, 0.311945, 0.39822108, 0.20984375, 0.186193, 0.9443724, 0.73955077, 0.49045882, 0.22741462, 0.25435647, 0.05802916, 0.43441662, 0.3117959, 0.6963435, 0.37775183, 0.17960368, 0.024678728, 0.06724963, 0.67939276, 0.45369685, 0.5365792, 0.8966713, 0.9903389, 0.21689698, 0.6630782, 0.26332238, 0.020651, 0.7583786, 0.32001716, 0.3834639, 0.5883171, 0.8310484, 0.6289818, 0.8726507, 0.27354205, 0.7980468, 0.18563594, 0.95279163, 0.68748826, 0.21550767, 0.9473706, 0.7308558, 0.25394166, 0.21331197, 0.5182007, 0.025662718, 0.20747007, 0.42468548, 0.37416998, 0.46357542, 0.27762872, 0.58678436, 0.8638556, 0.11753186, 0.5173791, 0.13206811, 0.7168597, 0.3960597, 0.5654213, 0.18327984, 0.14484777, 0.48805627, 0.35561273, 0.94043195, 0.76532525, 0.7486636, 0.9037197, 0.08342244, 0.55219245, 0.58447605, 0.96193635, 0.29214752, 0.24082878, 0.10029394, 0.01642963, 0.9295293, 0.66991657, 0.7851529, 0.28173012, 0.58641016, 0.06395527, 0.4856276, 0.97749513, 0.87650526, 0.33815897, 0.96157014, 0.23170163, 0.9493188, 0.9413777, 0.79920256, 0.6304479, 0.87428796, 0.29302028, 0.84894353, 0.6178767, 0.013236858, 0.3472335, 0.14814086, 0.9818294, 0.4783703, 0.49739137, 0.63947254, 0.3685846, 0.13690028, 0.82211775, 0.18984792, 0.511319, 0.22431703, 0.09784448, 0.8621915, 0.97291946, 0.9608347, 0.9065555, 0.7740473, 0.33314514, 0.08110139, 0.40724117, 0.23223414, 0.13248764, 0.053427182, 0.72559434, 0.011427458, 0.77058077, 0.14694664, 0.07952208, 0.08960304, 0.6720478, 0.24536721, 0.42053947, 0.5573688, 0.8605512, 0.7270443, 0.2703279, 0.1314828, 0.05537432, 0.30159864, 0.26211816, 0.45614058, 0.68328136, 0.6956254, 0.28351885, 0.37992695, 0.18115096, 0.7885455, 0.056848075, 0.6969972, 0.7786954, 0.7774076, 0.25942257, 0.37381315, 0.58759964, 0.2728219, 0.3708528, 0.19705428, 0.45985588, 0.0446123, 0.79979587, 0.07695644, 0.5188351, 0.3068101, 0.57754296, 0.9594333, 0.6455702, 0.035362437, 0.43040243, 0.51001686, 0.5361775, 0.6813925, 0.2775961, 0.12886056, 0.39267567, 0.9564057, 0.1871309, 0.90398395, 0.54380596, 0.4569114, 0.8820414, 0.45860395, 0.72416764, 0.39902532, 0.9040444, 0.69002503, 0.69962204, 0.3277204, 0.75677866, 0.6360611, 0.24002028, 0.16053882, 0.7963915, 0.9591666, 0.45813882, 0.59098417, 0.85772264, 0.45722345, 0.9518745, 0.5757512, 0.8207671, 0.9088437, 0.8155238, 0.15941447, 0.62889844, 0.39843425, 0.06271295, 0.42403224, 0.25868407, 0.8490383, 0.033304628, 0.9589827, 0.35536885, 0.3567069, 0.016328502, 0.18523233, 0.4012595, 0.9292914, 0.09961493, 0.94530153, 0.86948854, 0.4541624, 0.3267009, 0.23274413, 0.6144647, 0.03307459, 0.015606064, 0.42879573, 0.06807408, 0.251941, 0.22116092, 0.2531912, 0.13105524, 0.012036223, 0.1154843, 0.61848027, 0.9742562, 0.990345, 0.4090541, 0.16295442, 0.63876176, 0.49030533, 0.9894098, 0.065304205, 0.7832344, 0.2883985, 0.24141861, 0.66250455, 0.24606319, 0.6658591, 0.51730853, 0.42408898, 0.5546878, 0.28705153, 0.7065747, 0.41485688, 0.36054555, 0.8286569, 0.92496693, 0.04600731, 0.23262699, 0.34851936, 0.8149665, 0.98549145, 0.9689717, 0.90494835, 0.29655626, 0.99201125, 0.24942005, 0.10590615, 0.9509526, 0.23342025, 0.68976825, 0.05835636, 0.7307091, 0.8817202, 0.2724369, 0.3790569, 0.3742962, 0.74878824, 0.23780724, 0.1718531, 0.44929165, 0.3044684, 0.8391891, 0.23774183, 0.50238943, 0.9425836, 0.6339977, 0.8672894, 0.9402097, 0.75076485, 0.69957507, 0.96796554, 0.9944008, 0.45182168, 0.07086978, 0.29279402, 0.1523547, 0.41748637, 0.13128933, 0.6041178, 0.38280806, 0.89538586, 0.96779466, 0.5468849, 0.27482358, 0.59223044, 0.8967612, 0.40673333, 0.55207825, 0.27165276, 0.45544416, 0.40171355, 0.24841346, 0.5058664, 0.31038082, 0.37303486, 0.5249705, 0.75059503, 0.33350748, 0.92415875, 0.8623186, 0.048690297, 0.25364253, 0.44613552, 0.10462789, 0.348476, 0.7400975, 0.68051445, 0.6223844, 0.7105284, 0.20492369, 0.3416981, 0.6762425, 0.8792348, 0.54367805, 0.28269964, 0.030235259, 0.7103368, 0.007884104, 0.37267908, 0.5305372, 0.92211145, 0.08949455, 0.40594232, 0.0243132, 0.34261099, 0.62223107, 0.27906793, 0.20974995, 0.11570323, 0.5771403, 0.69527, 0.67195714, 0.948861}), + ), + + tensor.New( + tensor.WithShape(3, 6, 6), + tensor.WithBacking([]int32{1, 4, 0, 0, 2, 3, 1, 0, 0, 0, 0, 2, 4, 0, 2, 3, 4, 3, 4, 4, 4, 2, 1, 3, 4, 4, 0, 0, 2, 4, 3, 3, 0, 0, 1, 4, 4, 0, 0, 0, 1, 1, 1, 4, 1, 4, 0, 4, 3, 2, 0, 3, 2, 3, 2, 2, 1, 3, 3, 0, 4, 3, 3, 0, 0, 1, 4, 4, 1, 0, 0, 0, 3, 4, 4, 2, 2, 3, 3, 4, 2, 1, 0, 4, 1, 3, 0, 3, 2, 1, 0, 0, 3, 4, 1, 0, 0, 2, 1, 1, 0, 1, 1, 0, 0, 3, 3, 3}), + ), + + tensor.New( + tensor.WithShape(5), + tensor.WithBacking([]float32{0.5834042, 0.9364681, 0.94078165, 0.052508168, 0.59621114}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{-0.5416459}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight_reduction_mean_test.go b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight_reduction_mean_test.go new file mode 100644 index 00000000..d4e813d7 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight_reduction_mean_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeightReductionMean(t *testing.T) { + mytest := NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeightReductionMean() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight_reduction_sum.go b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight_reduction_sum.go new file mode 100644 index 00000000..fbb1f52a --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight_reduction_sum.go @@ -0,0 +1,212 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("NegativeLogLikelihoodLoss", "TestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeightReductionSum", NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeightReductionSum) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:12}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"input", "target", "weight"}, + Output: {"loss"}, + Name: "", + OpType: "NegativeLogLikelihoodLoss", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "reduction", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x73, 0x75, 0x6d}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight_reduction_sum", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "input", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "target", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "weight", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "loss", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeightReductionSum version: 6. +func NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeightReductionSum() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "NegativeLogLikelihoodLoss", + Title: "TestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeightReductionSum", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x87, 0x2, 0xa, 0x4d, 0xa, 0x5, 0x69, 0x6e, 0x70, 0x75, 0x74, 0xa, 0x6, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0xa, 0x6, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x4, 0x6c, 0x6f, 0x73, 0x73, 0x22, 0x19, 0x4e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x4c, 0x6f, 0x67, 0x4c, 0x69, 0x6b, 0x65, 0x6c, 0x69, 0x68, 0x6f, 0x6f, 0x64, 0x4c, 0x6f, 0x73, 0x73, 0x2a, 0x13, 0xa, 0x9, 0x72, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3, 0x73, 0x75, 0x6d, 0xa0, 0x1, 0x3, 0x12, 0x51, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x69, 0x6b, 0x65, 0x6c, 0x69, 0x68, 0x6f, 0x6f, 0x64, 0x5f, 0x6c, 0x6f, 0x73, 0x73, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x5f, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x69, 0x73, 0x5f, 0x4e, 0x43, 0x64, 0x31, 0x64, 0x32, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x75, 0x6d, 0x5a, 0x1f, 0xa, 0x5, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x5, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x6, 0x5a, 0x1c, 0xa, 0x6, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x12, 0xa, 0x10, 0x8, 0x6, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x6, 0x5a, 0x14, 0xa, 0x6, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0xe, 0xa, 0x4, 0x6c, 0x6f, 0x73, 0x73, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x42, 0x2, 0x10, 0xc}, + + /* + + &ir.NodeProto{ + Input: []string{"input", "target", "weight"}, + Output: []string{"loss"}, + Name: "", + OpType: "NegativeLogLikelihoodLoss", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217700)(name:"reduction" type:STRING s:"sum" ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 5, 6, 6), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256, 0.15896958, 0.11037514, 0.6563296, 0.13818295, 0.19658236, 0.36872518, 0.82099324, 0.09710128, 0.8379449, 0.09609841, 0.97645944, 0.4686512, 0.9767611, 0.6048455, 0.7392636, 0.039187793, 0.28280696, 0.12019656, 0.2961402, 0.11872772, 0.31798318, 0.41426298, 0.064147495, 0.6924721, 0.56660146, 0.2653895, 0.5232481, 0.09394051, 0.5759465, 0.9292962, 0.31856894, 0.6674104, 0.13179787, 0.7163272, 0.2894061, 0.18319136, 0.5865129, 0.020107547, 0.82894003, 0.004695476, 0.6778165, 0.27000797, 0.735194, 0.96218854, 0.24875315, 0.57615733, 0.5920419, 0.5722519, 0.22308163, 0.952749, 0.44712538, 0.84640867, 0.6994793, 0.29743695, 0.81379783, 0.39650574, 0.8811032, 0.5812729, 0.8817354, 0.6925316, 0.7252543, 0.50132436, 0.95608366, 0.6439902, 0.42385504, 0.6063932, 0.019193199, 0.30157483, 0.66017354, 0.2900776, 0.6180154, 0.4287687, 0.13547407, 0.29828233, 0.5699649, 0.59087276, 0.57432526, 0.6532008, 0.65210325, 0.43141845, 0.8965466, 0.36756188, 0.43586493, 0.89192337, 0.806194, 0.7038886, 0.10022689, 0.9194826, 0.7142413, 0.998847, 0.1494483, 0.86812603, 0.16249293, 0.6155596, 0.123819984, 0.8480082, 0.807319, 0.56910074, 0.4071833, 0.069166996, 0.69742876, 0.45354268, 0.7220556, 0.8663823, 0.9755215, 0.8558034, 0.011714084, 0.35997805, 0.72999054, 0.17162968, 0.5210366, 0.05433799, 0.19999653, 0.018521795, 0.7936977, 0.22392468, 0.34535167, 0.9280813, 0.7044144, 0.03183893, 0.16469416, 0.6214784, 0.5772286, 0.23789282, 0.934214, 0.6139659, 0.5356328, 0.58991, 0.730122, 0.311945, 0.39822108, 0.20984375, 0.186193, 0.9443724, 0.73955077, 0.49045882, 0.22741462, 0.25435647, 0.05802916, 0.43441662, 0.3117959, 0.6963435, 0.37775183, 0.17960368, 0.024678728, 0.06724963, 0.67939276, 0.45369685, 0.5365792, 0.8966713, 0.9903389, 0.21689698, 0.6630782, 0.26332238, 0.020651, 0.7583786, 0.32001716, 0.3834639, 0.5883171, 0.8310484, 0.6289818, 0.8726507, 0.27354205, 0.7980468, 0.18563594, 0.95279163, 0.68748826, 0.21550767, 0.9473706, 0.7308558, 0.25394166, 0.21331197, 0.5182007, 0.025662718, 0.20747007, 0.42468548, 0.37416998, 0.46357542, 0.27762872, 0.58678436, 0.8638556, 0.11753186, 0.5173791, 0.13206811, 0.7168597, 0.3960597, 0.5654213, 0.18327984, 0.14484777, 0.48805627, 0.35561273, 0.94043195, 0.76532525, 0.7486636, 0.9037197, 0.08342244, 0.55219245, 0.58447605, 0.96193635, 0.29214752, 0.24082878, 0.10029394, 0.01642963, 0.9295293, 0.66991657, 0.7851529, 0.28173012, 0.58641016, 0.06395527, 0.4856276, 0.97749513, 0.87650526, 0.33815897, 0.96157014, 0.23170163, 0.9493188, 0.9413777, 0.79920256, 0.6304479, 0.87428796, 0.29302028, 0.84894353, 0.6178767, 0.013236858, 0.3472335, 0.14814086, 0.9818294, 0.4783703, 0.49739137, 0.63947254, 0.3685846, 0.13690028, 0.82211775, 0.18984792, 0.511319, 0.22431703, 0.09784448, 0.8621915, 0.97291946, 0.9608347, 0.9065555, 0.7740473, 0.33314514, 0.08110139, 0.40724117, 0.23223414, 0.13248764, 0.053427182, 0.72559434, 0.011427458, 0.77058077, 0.14694664, 0.07952208, 0.08960304, 0.6720478, 0.24536721, 0.42053947, 0.5573688, 0.8605512, 0.7270443, 0.2703279, 0.1314828, 0.05537432, 0.30159864, 0.26211816, 0.45614058, 0.68328136, 0.6956254, 0.28351885, 0.37992695, 0.18115096, 0.7885455, 0.056848075, 0.6969972, 0.7786954, 0.7774076, 0.25942257, 0.37381315, 0.58759964, 0.2728219, 0.3708528, 0.19705428, 0.45985588, 0.0446123, 0.79979587, 0.07695644, 0.5188351, 0.3068101, 0.57754296, 0.9594333, 0.6455702, 0.035362437, 0.43040243, 0.51001686, 0.5361775, 0.6813925, 0.2775961, 0.12886056, 0.39267567, 0.9564057, 0.1871309, 0.90398395, 0.54380596, 0.4569114, 0.8820414, 0.45860395, 0.72416764, 0.39902532, 0.9040444, 0.69002503, 0.69962204, 0.3277204, 0.75677866, 0.6360611, 0.24002028, 0.16053882, 0.7963915, 0.9591666, 0.45813882, 0.59098417, 0.85772264, 0.45722345, 0.9518745, 0.5757512, 0.8207671, 0.9088437, 0.8155238, 0.15941447, 0.62889844, 0.39843425, 0.06271295, 0.42403224, 0.25868407, 0.8490383, 0.033304628, 0.9589827, 0.35536885, 0.3567069, 0.016328502, 0.18523233, 0.4012595, 0.9292914, 0.09961493, 0.94530153, 0.86948854, 0.4541624, 0.3267009, 0.23274413, 0.6144647, 0.03307459, 0.015606064, 0.42879573, 0.06807408, 0.251941, 0.22116092, 0.2531912, 0.13105524, 0.012036223, 0.1154843, 0.61848027, 0.9742562, 0.990345, 0.4090541, 0.16295442, 0.63876176, 0.49030533, 0.9894098, 0.065304205, 0.7832344, 0.2883985, 0.24141861, 0.66250455, 0.24606319, 0.6658591, 0.51730853, 0.42408898, 0.5546878, 0.28705153, 0.7065747, 0.41485688, 0.36054555, 0.8286569, 0.92496693, 0.04600731, 0.23262699, 0.34851936, 0.8149665, 0.98549145, 0.9689717, 0.90494835, 0.29655626, 0.99201125, 0.24942005, 0.10590615, 0.9509526, 0.23342025, 0.68976825, 0.05835636, 0.7307091, 0.8817202, 0.2724369, 0.3790569, 0.3742962, 0.74878824, 0.23780724, 0.1718531, 0.44929165, 0.3044684, 0.8391891, 0.23774183, 0.50238943, 0.9425836, 0.6339977, 0.8672894, 0.9402097, 0.75076485, 0.69957507, 0.96796554, 0.9944008, 0.45182168, 0.07086978, 0.29279402, 0.1523547, 0.41748637, 0.13128933, 0.6041178, 0.38280806, 0.89538586, 0.96779466, 0.5468849, 0.27482358, 0.59223044, 0.8967612, 0.40673333, 0.55207825, 0.27165276, 0.45544416, 0.40171355, 0.24841346, 0.5058664, 0.31038082, 0.37303486, 0.5249705, 0.75059503, 0.33350748, 0.92415875, 0.8623186, 0.048690297, 0.25364253, 0.44613552, 0.10462789, 0.348476, 0.7400975, 0.68051445, 0.6223844, 0.7105284, 0.20492369, 0.3416981, 0.6762425, 0.8792348, 0.54367805, 0.28269964, 0.030235259, 0.7103368, 0.007884104, 0.37267908, 0.5305372, 0.92211145, 0.08949455, 0.40594232, 0.0243132, 0.34261099, 0.62223107, 0.27906793, 0.20974995, 0.11570323, 0.5771403, 0.69527, 0.67195714, 0.948861}), + ), + + tensor.New( + tensor.WithShape(3, 6, 6), + tensor.WithBacking([]int32{1, 4, 0, 0, 2, 3, 1, 0, 0, 0, 0, 2, 4, 0, 2, 3, 4, 3, 4, 4, 4, 2, 1, 3, 4, 4, 0, 0, 2, 4, 3, 3, 0, 0, 1, 4, 4, 0, 0, 0, 1, 1, 1, 4, 1, 4, 0, 4, 3, 2, 0, 3, 2, 3, 2, 2, 1, 3, 3, 0, 4, 3, 3, 0, 0, 1, 4, 4, 1, 0, 0, 0, 3, 4, 4, 2, 2, 3, 3, 4, 2, 1, 0, 4, 1, 3, 0, 3, 2, 1, 0, 0, 3, 4, 1, 0, 0, 2, 1, 1, 0, 1, 1, 0, 0, 3, 3, 3}), + ), + + tensor.New( + tensor.WithShape(5), + tensor.WithBacking([]float32{0.5834042, 0.9364681, 0.94078165, 0.052508168, 0.59621114}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{-34.297665}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight_reduction_sum_test.go b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight_reduction_sum_test.go new file mode 100644 index 00000000..84ad8e6c --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight_reduction_sum_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeightReductionSum(t *testing.T) { + mytest := NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeightReductionSum() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight_test.go b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight_test.go new file mode 100644 index 00000000..e20db915 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_negative_log_likelihood_loss_input_shape_is_NCd1d2_with_weight_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeight(t *testing.T) { + mytest := NewTestNegativeLogLikelihoodLossInputShapeIsNCd1d2WithWeight() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_center_point_box_format.go b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_center_point_box_format.go index c837880d..f92990a8 100644 --- a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_center_point_box_format.go +++ b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_center_point_box_format.go @@ -11,6 +11,203 @@ func init() { testbackend.Register("NonMaxSuppression", "TestNonmaxsuppressionCenterPointBoxFormat", NewTestNonmaxsuppressionCenterPointBoxFormat) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"boxes", "scores", "max_output_boxes_per_class", "iou_threshold", "score_threshold"}, + Output: {"selected_indices"}, + Name: "", + OpType: "NonMaxSuppression", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "center_point_box", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_nonmaxsuppression_center_point_box_format", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "boxes", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "scores", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "max_output_boxes_per_class", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "iou_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "score_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "selected_indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestNonmaxsuppressionCenterPointBoxFormat version: 5. func NewTestNonmaxsuppressionCenterPointBoxFormat() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +223,7 @@ func NewTestNonmaxsuppressionCenterPointBoxFormat() *testbackend.TestCase { Name: "", OpType: "NonMaxSuppression", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126e00)(name:"center_point_box" type:INT i:1 ) + (*ir.AttributeProto)(0xc000216c00)(name:"center_point_box" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_flipped_coordinates.go b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_flipped_coordinates.go index 495332ff..396bae34 100644 --- a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_flipped_coordinates.go +++ b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_flipped_coordinates.go @@ -11,6 +11,184 @@ func init() { testbackend.Register("NonMaxSuppression", "TestNonmaxsuppressionFlippedCoordinates", NewTestNonmaxsuppressionFlippedCoordinates) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"boxes", "scores", "max_output_boxes_per_class", "iou_threshold", "score_threshold"}, + Output: {"selected_indices"}, + Name: "", + OpType: "NonMaxSuppression", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_nonmaxsuppression_flipped_coordinates", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "boxes", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "scores", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "max_output_boxes_per_class", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "iou_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "score_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "selected_indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestNonmaxsuppressionFlippedCoordinates version: 5. func NewTestNonmaxsuppressionFlippedCoordinates() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_identical_boxes.go b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_identical_boxes.go index a63cab2d..873bd4b3 100644 --- a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_identical_boxes.go +++ b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_identical_boxes.go @@ -11,6 +11,184 @@ func init() { testbackend.Register("NonMaxSuppression", "TestNonmaxsuppressionIdenticalBoxes", NewTestNonmaxsuppressionIdenticalBoxes) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"boxes", "scores", "max_output_boxes_per_class", "iou_threshold", "score_threshold"}, + Output: {"selected_indices"}, + Name: "", + OpType: "NonMaxSuppression", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_nonmaxsuppression_identical_boxes", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "boxes", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "scores", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "max_output_boxes_per_class", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "iou_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "score_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "selected_indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestNonmaxsuppressionIdenticalBoxes version: 5. func NewTestNonmaxsuppressionIdenticalBoxes() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_limit_output_size.go b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_limit_output_size.go index bad89980..abe976d1 100644 --- a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_limit_output_size.go +++ b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_limit_output_size.go @@ -11,6 +11,184 @@ func init() { testbackend.Register("NonMaxSuppression", "TestNonmaxsuppressionLimitOutputSize", NewTestNonmaxsuppressionLimitOutputSize) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"boxes", "scores", "max_output_boxes_per_class", "iou_threshold", "score_threshold"}, + Output: {"selected_indices"}, + Name: "", + OpType: "NonMaxSuppression", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_nonmaxsuppression_limit_output_size", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "boxes", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "scores", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "max_output_boxes_per_class", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "iou_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "score_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "selected_indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestNonmaxsuppressionLimitOutputSize version: 5. func NewTestNonmaxsuppressionLimitOutputSize() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_single_box.go b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_single_box.go index 608a720a..3850d1cb 100644 --- a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_single_box.go +++ b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_single_box.go @@ -11,6 +11,184 @@ func init() { testbackend.Register("NonMaxSuppression", "TestNonmaxsuppressionSingleBox", NewTestNonmaxsuppressionSingleBox) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"boxes", "scores", "max_output_boxes_per_class", "iou_threshold", "score_threshold"}, + Output: {"selected_indices"}, + Name: "", + OpType: "NonMaxSuppression", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_nonmaxsuppression_single_box", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "boxes", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "scores", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "max_output_boxes_per_class", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "iou_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "score_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "selected_indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestNonmaxsuppressionSingleBox version: 5. func NewTestNonmaxsuppressionSingleBox() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_suppress_by_IOU.go b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_suppress_by_IOU.go index 122c07ed..5a16bc90 100644 --- a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_suppress_by_IOU.go +++ b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_suppress_by_IOU.go @@ -11,6 +11,184 @@ func init() { testbackend.Register("NonMaxSuppression", "TestNonmaxsuppressionSuppressByIOU", NewTestNonmaxsuppressionSuppressByIOU) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"boxes", "scores", "max_output_boxes_per_class", "iou_threshold", "score_threshold"}, + Output: {"selected_indices"}, + Name: "", + OpType: "NonMaxSuppression", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_nonmaxsuppression_suppress_by_IOU", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "boxes", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "scores", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "max_output_boxes_per_class", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "iou_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "score_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "selected_indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestNonmaxsuppressionSuppressByIOU version: 5. func NewTestNonmaxsuppressionSuppressByIOU() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_suppress_by_IOU_and_scores.go b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_suppress_by_IOU_and_scores.go index d9764e87..fef481d0 100644 --- a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_suppress_by_IOU_and_scores.go +++ b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_suppress_by_IOU_and_scores.go @@ -11,6 +11,184 @@ func init() { testbackend.Register("NonMaxSuppression", "TestNonmaxsuppressionSuppressByIOUAndScores", NewTestNonmaxsuppressionSuppressByIOUAndScores) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"boxes", "scores", "max_output_boxes_per_class", "iou_threshold", "score_threshold"}, + Output: {"selected_indices"}, + Name: "", + OpType: "NonMaxSuppression", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_nonmaxsuppression_suppress_by_IOU_and_scores", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "boxes", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "scores", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "max_output_boxes_per_class", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "iou_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "score_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "selected_indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestNonmaxsuppressionSuppressByIOUAndScores version: 5. func NewTestNonmaxsuppressionSuppressByIOUAndScores() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_two_batches.go b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_two_batches.go index 262b5879..be6af81d 100644 --- a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_two_batches.go +++ b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_two_batches.go @@ -11,6 +11,184 @@ func init() { testbackend.Register("NonMaxSuppression", "TestNonmaxsuppressionTwoBatches", NewTestNonmaxsuppressionTwoBatches) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"boxes", "scores", "max_output_boxes_per_class", "iou_threshold", "score_threshold"}, + Output: {"selected_indices"}, + Name: "", + OpType: "NonMaxSuppression", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_nonmaxsuppression_two_batches", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "boxes", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "scores", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "max_output_boxes_per_class", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "iou_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "score_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "selected_indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestNonmaxsuppressionTwoBatches version: 5. func NewTestNonmaxsuppressionTwoBatches() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_two_classes.go b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_two_classes.go index aba7db27..a4d0c684 100644 --- a/backend/testbackend/onnx/onnx_test_nonmaxsuppression_two_classes.go +++ b/backend/testbackend/onnx/onnx_test_nonmaxsuppression_two_classes.go @@ -11,6 +11,184 @@ func init() { testbackend.Register("NonMaxSuppression", "TestNonmaxsuppressionTwoClasses", NewTestNonmaxsuppressionTwoClasses) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"boxes", "scores", "max_output_boxes_per_class", "iou_threshold", "score_threshold"}, + Output: {"selected_indices"}, + Name: "", + OpType: "NonMaxSuppression", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_nonmaxsuppression_two_classes", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "boxes", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "scores", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "max_output_boxes_per_class", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "iou_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "score_threshold", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "selected_indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestNonmaxsuppressionTwoClasses version: 5. func NewTestNonmaxsuppressionTwoClasses() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_onehot_negative_indices.go b/backend/testbackend/onnx/onnx_test_onehot_negative_indices.go new file mode 100644 index 00000000..4e95d1bf --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_onehot_negative_indices.go @@ -0,0 +1,203 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("OneHot", "TestOnehotNegativeIndices", NewTestOnehotNegativeIndices) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"indices", "depth", "values"}, + Output: {"y"}, + Name: "", + OpType: "OneHot", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_onehot_negative_indices", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "depth", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "values", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestOnehotNegativeIndices version: 6. +func NewTestOnehotNegativeIndices() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "OneHot", + Title: "TestOnehotNegativeIndices", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xa7, 0x1, 0xa, 0x30, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0xa, 0x5, 0x64, 0x65, 0x70, 0x74, 0x68, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0x6, 0x4f, 0x6e, 0x65, 0x48, 0x6f, 0x74, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1c, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x6e, 0x65, 0x68, 0x6f, 0x74, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x5a, 0x15, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x13, 0xa, 0x5, 0x64, 0x65, 0x70, 0x74, 0x68, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x5a, 0x14, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0xa, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"indices", "depth", "values"}, + Output: []string{"y"}, + Name: "", + OpType: "OneHot", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217000)(name:"axis" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]int64{0, -7, -8}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{10}), + ), + + tensor.New( + tensor.WithShape(2), + tensor.WithBacking([]float32{1, 3}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 10), + tensor.WithBacking([]float32{3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_onehot_negative_indices_test.go b/backend/testbackend/onnx/onnx_test_onehot_negative_indices_test.go new file mode 100644 index 00000000..1c66d017 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_onehot_negative_indices_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestOnehotNegativeIndices(t *testing.T) { + mytest := NewTestOnehotNegativeIndices() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_onehot_with_axis.go b/backend/testbackend/onnx/onnx_test_onehot_with_axis.go index 70691280..ac354625 100644 --- a/backend/testbackend/onnx/onnx_test_onehot_with_axis.go +++ b/backend/testbackend/onnx/onnx_test_onehot_with_axis.go @@ -11,12 +11,161 @@ func init() { testbackend.Register("OneHot", "TestOnehotWithAxis", NewTestOnehotWithAxis) } -// NewTestOnehotWithAxis version: 3. +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"indices", "depth", "values"}, + Output: {"y"}, + Name: "", + OpType: "OneHot", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_onehot_with_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "depth", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "values", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestOnehotWithAxis version: 5. func NewTestOnehotWithAxis() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "OneHot", Title: "TestOnehotWithAxis", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xa8, 0x1, 0xa, 0x30, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0xa, 0x5, 0x64, 0x65, 0x70, 0x74, 0x68, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0x6, 0x4f, 0x6e, 0x65, 0x48, 0x6f, 0x74, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x6e, 0x65, 0x68, 0x6f, 0x74, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x13, 0xa, 0x5, 0x64, 0x65, 0x70, 0x74, 0x68, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x5a, 0x14, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x62, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0xa, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xa8, 0x1, 0xa, 0x30, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0xa, 0x5, 0x64, 0x65, 0x70, 0x74, 0x68, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0x6, 0x4f, 0x6e, 0x65, 0x48, 0x6f, 0x74, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x6e, 0x65, 0x68, 0x6f, 0x74, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x13, 0xa, 0x5, 0x64, 0x65, 0x70, 0x74, 0x68, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x5a, 0x14, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x62, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0xa, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, /* @@ -26,7 +175,7 @@ func NewTestOnehotWithAxis() *testbackend.TestCase { Name: "", OpType: "OneHot", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc0002e0800)(name:"axis" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217400)(name:"axis" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_onehot_with_negative_axis.go b/backend/testbackend/onnx/onnx_test_onehot_with_negative_axis.go new file mode 100644 index 00000000..534011fa --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_onehot_with_negative_axis.go @@ -0,0 +1,211 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("OneHot", "TestOnehotWithNegativeAxis", NewTestOnehotWithNegativeAxis) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"indices", "depth", "values"}, + Output: {"y"}, + Name: "", + OpType: "OneHot", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_onehot_with_negative_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "depth", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "values", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestOnehotWithNegativeAxis version: 6. +func NewTestOnehotWithNegativeAxis() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "OneHot", + Title: "TestOnehotWithNegativeAxis", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xba, 0x1, 0xa, 0x39, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0xa, 0x5, 0x64, 0x65, 0x70, 0x74, 0x68, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0x6, 0x4f, 0x6e, 0x65, 0x48, 0x6f, 0x74, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x6e, 0x65, 0x68, 0x6f, 0x74, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x13, 0xa, 0x5, 0x64, 0x65, 0x70, 0x74, 0x68, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x5a, 0x14, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x62, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0xa, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"indices", "depth", "values"}, + Output: []string{"y"}, + Name: "", + OpType: "OneHot", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0001e6100)(name:"axis" type:INT i:-2 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 2), + tensor.WithBacking([]float32{1, 9, 2, 4}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{10}), + ), + + tensor.New( + tensor.WithShape(2), + tensor.WithBacking([]float32{1, 3}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 10, 2), + tensor.WithBacking([]float32{1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_onehot_with_negative_axis_test.go b/backend/testbackend/onnx/onnx_test_onehot_with_negative_axis_test.go new file mode 100644 index 00000000..5e5f8f6d --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_onehot_with_negative_axis_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestOnehotWithNegativeAxis(t *testing.T) { + mytest := NewTestOnehotWithNegativeAxis() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_onehot_without_axis.go b/backend/testbackend/onnx/onnx_test_onehot_without_axis.go index 1076339f..52ee38a2 100644 --- a/backend/testbackend/onnx/onnx_test_onehot_without_axis.go +++ b/backend/testbackend/onnx/onnx_test_onehot_without_axis.go @@ -11,12 +11,127 @@ func init() { testbackend.Register("OneHot", "TestOnehotWithoutAxis", NewTestOnehotWithoutAxis) } -// NewTestOnehotWithoutAxis version: 3. +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"indices", "depth", "values"}, + Output: {"y"}, + Name: "", + OpType: "OneHot", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_onehot_without_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "depth", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "values", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:12}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestOnehotWithoutAxis version: 5. func NewTestOnehotWithoutAxis() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "OneHot", Title: "TestOnehotWithoutAxis", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x96, 0x1, 0xa, 0x23, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0xa, 0x5, 0x64, 0x65, 0x70, 0x74, 0x68, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0x6, 0x4f, 0x6e, 0x65, 0x48, 0x6f, 0x74, 0x12, 0x18, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x6e, 0x65, 0x68, 0x6f, 0x74, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x15, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x13, 0xa, 0x5, 0x64, 0x65, 0x70, 0x74, 0x68, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x5a, 0x14, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x6, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x6, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0xc, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x92, 0x1, 0xa, 0x23, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0xa, 0x5, 0x64, 0x65, 0x70, 0x74, 0x68, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0x6, 0x4f, 0x6e, 0x65, 0x48, 0x6f, 0x74, 0x12, 0x18, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x6e, 0x65, 0x68, 0x6f, 0x74, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x15, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x5a, 0xf, 0xa, 0x5, 0x64, 0x65, 0x70, 0x74, 0x68, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x5a, 0x14, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x6, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x6, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0xc, 0x42, 0x2, 0x10, 0xb}, /* diff --git a/backend/testbackend/onnx/onnx_test_pow.go b/backend/testbackend/onnx/onnx_test_pow.go index 5ee7d536..e016a3d7 100644 --- a/backend/testbackend/onnx/onnx_test_pow.go +++ b/backend/testbackend/onnx/onnx_test_pow.go @@ -11,6 +11,128 @@ func init() { testbackend.Register("Pow", "TestPow", NewTestPow) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Pow", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_pow", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestPow version: 3. func NewTestPow() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_pow_bcast_array.go b/backend/testbackend/onnx/onnx_test_pow_bcast_array.go index 51a73ca2..f9a48d82 100644 --- a/backend/testbackend/onnx/onnx_test_pow_bcast_array.go +++ b/backend/testbackend/onnx/onnx_test_pow_bcast_array.go @@ -11,6 +11,112 @@ func init() { testbackend.Register("Pow", "TestPowBcastArray", NewTestPowBcastArray) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Pow", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_pow_bcast_array", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestPowBcastArray version: 3. func NewTestPowBcastArray() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_pow_bcast_scalar.go b/backend/testbackend/onnx/onnx_test_pow_bcast_scalar.go index 21ed0a45..1c0f2700 100644 --- a/backend/testbackend/onnx/onnx_test_pow_bcast_scalar.go +++ b/backend/testbackend/onnx/onnx_test_pow_bcast_scalar.go @@ -11,6 +11,97 @@ func init() { testbackend.Register("Pow", "TestPowBcastScalar", NewTestPowBcastScalar) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Pow", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_pow_bcast_scalar", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestPowBcastScalar version: 3. func NewTestPowBcastScalar() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_pow_example.go b/backend/testbackend/onnx/onnx_test_pow_example.go index 45923765..7fa15001 100644 --- a/backend/testbackend/onnx/onnx_test_pow_example.go +++ b/backend/testbackend/onnx/onnx_test_pow_example.go @@ -11,6 +11,104 @@ func init() { testbackend.Register("Pow", "TestPowExample", NewTestPowExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Pow", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_pow_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestPowExample version: 3. func NewTestPowExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_prelu_broadcast.go b/backend/testbackend/onnx/onnx_test_prelu_broadcast.go index e0057ae9..d0e9549d 100644 --- a/backend/testbackend/onnx/onnx_test_prelu_broadcast.go +++ b/backend/testbackend/onnx/onnx_test_prelu_broadcast.go @@ -11,6 +11,120 @@ func init() { testbackend.Register("PRelu", "TestPreluBroadcast", NewTestPreluBroadcast) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "slope"}, + Output: {"y"}, + Name: "", + OpType: "PRelu", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_prelu_broadcast", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "slope", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestPreluBroadcast version: 3. func NewTestPreluBroadcast() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_prelu_example.go b/backend/testbackend/onnx/onnx_test_prelu_example.go index fe58b3d4..011ac4a1 100644 --- a/backend/testbackend/onnx/onnx_test_prelu_example.go +++ b/backend/testbackend/onnx/onnx_test_prelu_example.go @@ -11,6 +11,128 @@ func init() { testbackend.Register("PRelu", "TestPreluExample", NewTestPreluExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "slope"}, + Output: {"y"}, + Name: "", + OpType: "PRelu", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_prelu_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "slope", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestPreluExample version: 3. func NewTestPreluExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_range_float_type_positive_delta.go b/backend/testbackend/onnx/onnx_test_range_float_type_positive_delta.go new file mode 100644 index 00000000..c276b095 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_range_float_type_positive_delta.go @@ -0,0 +1,157 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Range", "TestRangeFloatTypePositiveDelta", NewTestRangeFloatTypePositiveDelta) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"start", "limit", "delta"}, + Output: {"output"}, + Name: "", + OpType: "Range", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_range_float_type_positive_delta", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "start", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "limit", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "delta", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestRangeFloatTypePositiveDelta version: 6. +func NewTestRangeFloatTypePositiveDelta() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Range", + Title: "TestRangeFloatTypePositiveDelta", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x95, 0x1, 0xa, 0x24, 0xa, 0x5, 0x73, 0x74, 0x61, 0x72, 0x74, 0xa, 0x5, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0xa, 0x5, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0x5, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x24, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x5a, 0xf, 0xa, 0x5, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x5a, 0xf, 0xa, 0x5, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x5a, 0xf, 0xa, 0x5, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x6, 0xa, 0x4, 0x8, 0x1, 0x12, 0x0, 0x62, 0x14, 0xa, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"start", "limit", "delta"}, + Output: []string{"output"}, + Name: "", + OpType: "Range", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{1}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{5}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{2}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2), + tensor.WithBacking([]float32{1, 3}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_range_float_type_positive_delta_test.go b/backend/testbackend/onnx/onnx_test_range_float_type_positive_delta_test.go new file mode 100644 index 00000000..978e0763 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_range_float_type_positive_delta_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestRangeFloatTypePositiveDelta(t *testing.T) { + mytest := NewTestRangeFloatTypePositiveDelta() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_range_int32_type_negative_delta.go b/backend/testbackend/onnx/onnx_test_range_int32_type_negative_delta.go new file mode 100644 index 00000000..e3453afb --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_range_int32_type_negative_delta.go @@ -0,0 +1,157 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Range", "TestRangeInt32TypeNegativeDelta", NewTestRangeInt32TypeNegativeDelta) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"start", "limit", "delta"}, + Output: {"output"}, + Name: "", + OpType: "Range", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_range_int32_type_negative_delta", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "start", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "limit", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "delta", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestRangeInt32TypeNegativeDelta version: 6. +func NewTestRangeInt32TypeNegativeDelta() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Range", + Title: "TestRangeInt32TypeNegativeDelta", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x95, 0x1, 0xa, 0x24, 0xa, 0x5, 0x73, 0x74, 0x61, 0x72, 0x74, 0xa, 0x5, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0xa, 0x5, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0x5, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x24, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x5a, 0xf, 0xa, 0x5, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x6, 0xa, 0x4, 0x8, 0x6, 0x12, 0x0, 0x5a, 0xf, 0xa, 0x5, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x6, 0xa, 0x4, 0x8, 0x6, 0x12, 0x0, 0x5a, 0xf, 0xa, 0x5, 0x64, 0x65, 0x6c, 0x74, 0x61, 0x12, 0x6, 0xa, 0x4, 0x8, 0x6, 0x12, 0x0, 0x62, 0x14, 0xa, 0x6, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0xa, 0xa, 0x8, 0x8, 0x6, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"start", "limit", "delta"}, + Output: []string{"output"}, + Name: "", + OpType: "Range", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{10}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{6}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{-3}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2), + tensor.WithBacking([]int32{10, 7}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_range_int32_type_negative_delta_test.go b/backend/testbackend/onnx/onnx_test_range_int32_type_negative_delta_test.go new file mode 100644 index 00000000..03d76e08 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_range_int32_type_negative_delta_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestRangeInt32TypeNegativeDelta(t *testing.T) { + mytest := NewTestRangeInt32TypeNegativeDelta() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reciprocal.go b/backend/testbackend/onnx/onnx_test_reciprocal.go index 2a2cb244..731995b2 100644 --- a/backend/testbackend/onnx/onnx_test_reciprocal.go +++ b/backend/testbackend/onnx/onnx_test_reciprocal.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Reciprocal", "TestReciprocal", NewTestReciprocal) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Reciprocal", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_reciprocal", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReciprocal version: 3. func NewTestReciprocal() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_reciprocal_example.go b/backend/testbackend/onnx/onnx_test_reciprocal_example.go index 73779b2f..fcd177b4 100644 --- a/backend/testbackend/onnx/onnx_test_reciprocal_example.go +++ b/backend/testbackend/onnx/onnx_test_reciprocal_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Reciprocal", "TestReciprocalExample", NewTestReciprocalExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Reciprocal", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_reciprocal_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReciprocalExample version: 3. func NewTestReciprocalExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_reduce_l1_default_axes_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_l1_default_axes_keepdims_example.go index d5e1a92b..c6618230 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_l1_default_axes_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_l1_default_axes_keepdims_example.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceL1", "TestReduceL1DefaultAxesKeepdimsExample", NewTestReduceL1DefaultAxesKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceL1", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_l1_default_axes_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceL1DefaultAxesKeepdimsExample version: 3. func NewTestReduceL1DefaultAxesKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceL1DefaultAxesKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceL1", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000133f00)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217d00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_l1_default_axes_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_l1_default_axes_keepdims_random.go index eafd561d..f2f4e45e 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_l1_default_axes_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_l1_default_axes_keepdims_random.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceL1", "TestReduceL1DefaultAxesKeepdimsRandom", NewTestReduceL1DefaultAxesKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceL1", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_l1_default_axes_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceL1DefaultAxesKeepdimsRandom version: 3. func NewTestReduceL1DefaultAxesKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceL1DefaultAxesKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceL1", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000127a00)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0002dc000)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_l1_do_not_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_l1_do_not_keepdims_example.go index 6b28852a..ddacbc43 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_l1_do_not_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_l1_do_not_keepdims_example.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceL1", "TestReduceL1DoNotKeepdimsExample", NewTestReduceL1DoNotKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceL1", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_l1_do_not_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceL1DoNotKeepdimsExample version: 3. func NewTestReduceL1DoNotKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceL1DoNotKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceL1", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc0002e0400)(name:"axes" type:INTS ints:2 ), - (*ir.AttributeProto)(0xc0002e0500)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc0002dc300)(name:"axes" type:INTS ints:2 ), + (*ir.AttributeProto)(0xc0002dc400)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_l1_do_not_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_l1_do_not_keepdims_random.go index b22400cf..372b2d45 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_l1_do_not_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_l1_do_not_keepdims_random.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceL1", "TestReduceL1DoNotKeepdimsRandom", NewTestReduceL1DoNotKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceL1", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_l1_do_not_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceL1DoNotKeepdimsRandom version: 3. func NewTestReduceL1DoNotKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceL1DoNotKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceL1", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000118300)(name:"axes" type:INTS ints:2 ), - (*ir.AttributeProto)(0xc000118400)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc0002dc800)(name:"axes" type:INTS ints:2 ), + (*ir.AttributeProto)(0xc0002dc900)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_l1_keep_dims_example.go b/backend/testbackend/onnx/onnx_test_reduce_l1_keep_dims_example.go index 74cc72cd..c94c08fb 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_l1_keep_dims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_l1_keep_dims_example.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceL1", "TestReduceL1KeepDimsExample", NewTestReduceL1KeepDimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceL1", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_l1_keep_dims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceL1KeepDimsExample version: 3. func NewTestReduceL1KeepDimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceL1KeepDimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceL1", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc0002e0e00)(name:"axes" type:INTS ints:2 ), - (*ir.AttributeProto)(0xc0002e0f00)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000216e00)(name:"axes" type:INTS ints:2 ), + (*ir.AttributeProto)(0xc000216f00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_l1_keep_dims_random.go b/backend/testbackend/onnx/onnx_test_reduce_l1_keep_dims_random.go index 63c94540..537b3298 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_l1_keep_dims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_l1_keep_dims_random.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceL1", "TestReduceL1KeepDimsRandom", NewTestReduceL1KeepDimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceL1", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_l1_keep_dims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceL1KeepDimsRandom version: 3. func NewTestReduceL1KeepDimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceL1KeepDimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceL1", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000118500)(name:"axes" type:INTS ints:2 ), - (*ir.AttributeProto)(0xc000118600)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217300)(name:"axes" type:INTS ints:2 ), + (*ir.AttributeProto)(0xc000217400)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_l1_negative_axes_keep_dims_example.go b/backend/testbackend/onnx/onnx_test_reduce_l1_negative_axes_keep_dims_example.go new file mode 100644 index 00000000..e7d8608d --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_l1_negative_axes_keep_dims_example.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceL1", "TestReduceL1NegativeAxesKeepDimsExample", NewTestReduceL1NegativeAxesKeepDimsExample) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceL1", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_l1_negative_axes_keep_dims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceL1NegativeAxesKeepDimsExample version: 6. +func NewTestReduceL1NegativeAxesKeepDimsExample() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceL1", + Title: "TestReduceL1NegativeAxesKeepDimsExample", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xad, 0x1, 0xa, 0x40, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0x8, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x4c, 0x31, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x6c, 0x31, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceL1", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000217f00)(name:"axes" type:INTS ints:-1 ), + (*ir.AttributeProto)(0xc0001e6100)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 1), + tensor.WithBacking([]float32{3, 7, 11, 15, 19, 23}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_l1_negative_axes_keep_dims_example_test.go b/backend/testbackend/onnx/onnx_test_reduce_l1_negative_axes_keep_dims_example_test.go new file mode 100644 index 00000000..44e71a85 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_l1_negative_axes_keep_dims_example_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceL1NegativeAxesKeepDimsExample(t *testing.T) { + mytest := NewTestReduceL1NegativeAxesKeepDimsExample() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_l1_negative_axes_keep_dims_random.go b/backend/testbackend/onnx/onnx_test_reduce_l1_negative_axes_keep_dims_random.go new file mode 100644 index 00000000..5687d70e --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_l1_negative_axes_keep_dims_random.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceL1", "TestReduceL1NegativeAxesKeepDimsRandom", NewTestReduceL1NegativeAxesKeepDimsRandom) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceL1", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_l1_negative_axes_keep_dims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceL1NegativeAxesKeepDimsRandom version: 6. +func NewTestReduceL1NegativeAxesKeepDimsRandom() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceL1", + Title: "TestReduceL1NegativeAxesKeepDimsRandom", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xac, 0x1, 0xa, 0x40, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0x8, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x4c, 0x31, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x6c, 0x31, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceL1", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc0001e6700)(name:"axes" type:INTS ints:-1 ), + (*ir.AttributeProto)(0xc0002dc000)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 1), + tensor.WithBacking([]float32{5.2800574, 2.9529312, 4.444786, 9.083715, 11.604425, 6.4123993}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_l1_negative_axes_keep_dims_random_test.go b/backend/testbackend/onnx/onnx_test_reduce_l1_negative_axes_keep_dims_random_test.go new file mode 100644 index 00000000..949b595d --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_l1_negative_axes_keep_dims_random_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceL1NegativeAxesKeepDimsRandom(t *testing.T) { + mytest := NewTestReduceL1NegativeAxesKeepDimsRandom() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_l2_default_axes_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_l2_default_axes_keepdims_example.go index d04af30e..69233c20 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_l2_default_axes_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_l2_default_axes_keepdims_example.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceL2", "TestReduceL2DefaultAxesKeepdimsExample", NewTestReduceL2DefaultAxesKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceL2", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_l2_default_axes_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceL2DefaultAxesKeepdimsExample version: 3. func NewTestReduceL2DefaultAxesKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceL2DefaultAxesKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceL2", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000118b00)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0002dc400)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_l2_default_axes_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_l2_default_axes_keepdims_random.go index c8989d1a..268f5243 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_l2_default_axes_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_l2_default_axes_keepdims_random.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceL2", "TestReduceL2DefaultAxesKeepdimsRandom", NewTestReduceL2DefaultAxesKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceL2", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_l2_default_axes_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceL2DefaultAxesKeepdimsRandom version: 3. func NewTestReduceL2DefaultAxesKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceL2DefaultAxesKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceL2", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000119000)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0002dc700)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_l2_do_not_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_l2_do_not_keepdims_example.go index 295d6df3..13514d49 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_l2_do_not_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_l2_do_not_keepdims_example.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceL2", "TestReduceL2DoNotKeepdimsExample", NewTestReduceL2DoNotKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceL2", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_l2_do_not_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceL2DoNotKeepdimsExample version: 3. func NewTestReduceL2DoNotKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceL2DoNotKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceL2", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc0002e1a00)(name:"axes" type:INTS ints:2 ), - (*ir.AttributeProto)(0xc0002e1b00)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc0002dcc00)(name:"axes" type:INTS ints:2 ), + (*ir.AttributeProto)(0xc0002dcd00)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_l2_do_not_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_l2_do_not_keepdims_random.go index 0807e9f8..6bbe1f06 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_l2_do_not_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_l2_do_not_keepdims_random.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceL2", "TestReduceL2DoNotKeepdimsRandom", NewTestReduceL2DoNotKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceL2", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_l2_do_not_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceL2DoNotKeepdimsRandom version: 3. func NewTestReduceL2DoNotKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceL2DoNotKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceL2", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000119600)(name:"axes" type:INTS ints:2 ), - (*ir.AttributeProto)(0xc000119700)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc0001e6100)(name:"axes" type:INTS ints:2 ), + (*ir.AttributeProto)(0xc0001e6400)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_l2_keep_dims_example.go b/backend/testbackend/onnx/onnx_test_reduce_l2_keep_dims_example.go index 64156017..d0d37fb0 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_l2_keep_dims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_l2_keep_dims_example.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceL2", "TestReduceL2KeepDimsExample", NewTestReduceL2KeepDimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceL2", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_l2_keep_dims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceL2KeepDimsExample version: 3. func NewTestReduceL2KeepDimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceL2KeepDimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceL2", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000119800)(name:"axes" type:INTS ints:2 ), - (*ir.AttributeProto)(0xc000119900)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000216b00)(name:"axes" type:INTS ints:2 ), + (*ir.AttributeProto)(0xc000216c00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_l2_keep_dims_random.go b/backend/testbackend/onnx/onnx_test_reduce_l2_keep_dims_random.go index 0ddbb675..327b52ac 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_l2_keep_dims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_l2_keep_dims_random.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceL2", "TestReduceL2KeepDimsRandom", NewTestReduceL2KeepDimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceL2", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_l2_keep_dims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceL2KeepDimsRandom version: 3. func NewTestReduceL2KeepDimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceL2KeepDimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceL2", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132500)(name:"axes" type:INTS ints:2 ), - (*ir.AttributeProto)(0xc000132600)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217000)(name:"axes" type:INTS ints:2 ), + (*ir.AttributeProto)(0xc000217100)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_l2_negative_axes_keep_dims_example.go b/backend/testbackend/onnx/onnx_test_reduce_l2_negative_axes_keep_dims_example.go new file mode 100644 index 00000000..8c5149fb --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_l2_negative_axes_keep_dims_example.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceL2", "TestReduceL2NegativeAxesKeepDimsExample", NewTestReduceL2NegativeAxesKeepDimsExample) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceL2", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_l2_negative_axes_keep_dims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceL2NegativeAxesKeepDimsExample version: 6. +func NewTestReduceL2NegativeAxesKeepDimsExample() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceL2", + Title: "TestReduceL2NegativeAxesKeepDimsExample", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xad, 0x1, 0xa, 0x40, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0x8, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x4c, 0x32, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x6c, 0x32, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceL2", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000217c00)(name:"axes" type:INTS ints:-1 ), + (*ir.AttributeProto)(0xc000217d00)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 1), + tensor.WithBacking([]float32{2.236068, 5, 7.81025, 10.630146, 13.453624, 16.27882}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_l2_negative_axes_keep_dims_example_test.go b/backend/testbackend/onnx/onnx_test_reduce_l2_negative_axes_keep_dims_example_test.go new file mode 100644 index 00000000..679eb119 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_l2_negative_axes_keep_dims_example_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceL2NegativeAxesKeepDimsExample(t *testing.T) { + mytest := NewTestReduceL2NegativeAxesKeepDimsExample() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_l2_negative_axes_keep_dims_random.go b/backend/testbackend/onnx/onnx_test_reduce_l2_negative_axes_keep_dims_random.go new file mode 100644 index 00000000..013626b1 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_l2_negative_axes_keep_dims_random.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceL2", "TestReduceL2NegativeAxesKeepDimsRandom", NewTestReduceL2NegativeAxesKeepDimsRandom) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceL2", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_l2_negative_axes_keep_dims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceL2NegativeAxesKeepDimsRandom version: 6. +func NewTestReduceL2NegativeAxesKeepDimsRandom() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceL2", + Title: "TestReduceL2NegativeAxesKeepDimsRandom", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xac, 0x1, 0xa, 0x40, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0x8, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x4c, 0x32, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x6c, 0x32, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceL2", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc0004c0200)(name:"axes" type:INTS ints:-1 ), + (*ir.AttributeProto)(0xc0004c0300)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 1), + tensor.WithBacking([]float32{4.413127, 2.2427495, 3.2932465, 7.934266, 9.561779, 5.863051}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_l2_negative_axes_keep_dims_random_test.go b/backend/testbackend/onnx/onnx_test_reduce_l2_negative_axes_keep_dims_random_test.go new file mode 100644 index 00000000..9de7ba64 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_l2_negative_axes_keep_dims_random_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceL2NegativeAxesKeepDimsRandom(t *testing.T) { + mytest := NewTestReduceL2NegativeAxesKeepDimsRandom() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_log_sum.go b/backend/testbackend/onnx/onnx_test_reduce_log_sum.go index 6d9834bc..e8b0a984 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_log_sum.go +++ b/backend/testbackend/onnx/onnx_test_reduce_log_sum.go @@ -11,6 +11,129 @@ func init() { testbackend.Register("ReduceLogSum", "TestReduceLogSum", NewTestReduceLogSum) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:6}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceLogSum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_log_sum", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceLogSum version: 3. func NewTestReduceLogSum() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +149,8 @@ func NewTestReduceLogSum() *testbackend.TestCase { Name: "", OpType: "ReduceLogSum", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132700)(name:"axes" type:INTS ints:2 ints:1 ), - (*ir.AttributeProto)(0xc000132800)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc0002dc000)(name:"axes" type:INTS ints:2 ints:1 ), + (*ir.AttributeProto)(0xc0002dc100)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_log_sum_asc_axes.go b/backend/testbackend/onnx/onnx_test_reduce_log_sum_asc_axes.go index 0319d6af..2940c9c5 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_log_sum_asc_axes.go +++ b/backend/testbackend/onnx/onnx_test_reduce_log_sum_asc_axes.go @@ -11,6 +11,129 @@ func init() { testbackend.Register("ReduceLogSum", "TestReduceLogSumAscAxes", NewTestReduceLogSumAscAxes) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceLogSum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_log_sum_asc_axes", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceLogSumAscAxes version: 3. func NewTestReduceLogSumAscAxes() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +149,8 @@ func NewTestReduceLogSumAscAxes() *testbackend.TestCase { Name: "", OpType: "ReduceLogSum", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000126b00)(name:"axes" type:INTS ints:0 ints:1 ), - (*ir.AttributeProto)(0xc000126c00)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc000216b00)(name:"axes" type:INTS ints:0 ints:1 ), + (*ir.AttributeProto)(0xc000216c00)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_log_sum_default.go b/backend/testbackend/onnx/onnx_test_reduce_log_sum_default.go index d1670307..809d6b89 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_log_sum_default.go +++ b/backend/testbackend/onnx/onnx_test_reduce_log_sum_default.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("ReduceLogSum", "TestReduceLogSumDefault", NewTestReduceLogSumDefault) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceLogSum", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_reduce_log_sum_default", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceLogSumDefault version: 3. func NewTestReduceLogSumDefault() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_reduce_log_sum_desc_axes.go b/backend/testbackend/onnx/onnx_test_reduce_log_sum_desc_axes.go index 9f2643a7..b94c850f 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_log_sum_desc_axes.go +++ b/backend/testbackend/onnx/onnx_test_reduce_log_sum_desc_axes.go @@ -11,6 +11,129 @@ func init() { testbackend.Register("ReduceLogSum", "TestReduceLogSumDescAxes", NewTestReduceLogSumDescAxes) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceLogSum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_log_sum_desc_axes", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceLogSumDescAxes version: 3. func NewTestReduceLogSumDescAxes() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +149,8 @@ func NewTestReduceLogSumDescAxes() *testbackend.TestCase { Name: "", OpType: "ReduceLogSum", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000127600)(name:"axes" type:INTS ints:2 ints:1 ), - (*ir.AttributeProto)(0xc000127700)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc000217200)(name:"axes" type:INTS ints:2 ints:1 ), + (*ir.AttributeProto)(0xc000217300)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_default_axes_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_default_axes_keepdims_example.go index 01c96256..a820b588 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_default_axes_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_default_axes_keepdims_example.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceLogSumExp", "TestReduceLogSumExpDefaultAxesKeepdimsExample", NewTestReduceLogSumExpDefaultAxesKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceLogSumExp", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_log_sum_exp_default_axes_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceLogSumExpDefaultAxesKeepdimsExample version: 3. func NewTestReduceLogSumExpDefaultAxesKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceLogSumExpDefaultAxesKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceLogSumExp", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000127d00)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217e00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_default_axes_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_default_axes_keepdims_random.go index 7461e03e..537b23c4 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_default_axes_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_default_axes_keepdims_random.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceLogSumExp", "TestReduceLogSumExpDefaultAxesKeepdimsRandom", NewTestReduceLogSumExpDefaultAxesKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceLogSumExp", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_log_sum_exp_default_axes_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceLogSumExpDefaultAxesKeepdimsRandom version: 3. func NewTestReduceLogSumExpDefaultAxesKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceLogSumExpDefaultAxesKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceLogSumExp", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000132d00)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0001e6400)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_do_not_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_do_not_keepdims_example.go index 492468fc..9a1d347b 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_do_not_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_do_not_keepdims_example.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceLogSumExp", "TestReduceLogSumExpDoNotKeepdimsExample", NewTestReduceLogSumExpDoNotKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceLogSumExp", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_log_sum_exp_do_not_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceLogSumExpDoNotKeepdimsExample version: 3. func NewTestReduceLogSumExpDoNotKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceLogSumExpDoNotKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceLogSumExp", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132f00)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000133000)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc0001e6700)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc0002bc000)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_do_not_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_do_not_keepdims_random.go index e9471e61..c83c4355 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_do_not_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_do_not_keepdims_random.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceLogSumExp", "TestReduceLogSumExpDoNotKeepdimsRandom", NewTestReduceLogSumExpDoNotKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceLogSumExp", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_log_sum_exp_do_not_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceLogSumExpDoNotKeepdimsRandom version: 3. func NewTestReduceLogSumExpDoNotKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceLogSumExpDoNotKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceLogSumExp", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000133600)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000133700)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc0002bc400)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc0002bc500)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_keepdims_example.go index fc1813ea..b9b7b19a 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_keepdims_example.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceLogSumExp", "TestReduceLogSumExpKeepdimsExample", NewTestReduceLogSumExpKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceLogSumExp", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_log_sum_exp_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceLogSumExpKeepdimsExample version: 3. func NewTestReduceLogSumExpKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceLogSumExpKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceLogSumExp", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000133c00)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000133d00)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0002bc900)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc0002bca00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_keepdims_random.go index 3fce5fc0..61bb5ca2 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_keepdims_random.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceLogSumExp", "TestReduceLogSumExpKeepdimsRandom", NewTestReduceLogSumExpKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceLogSumExp", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_log_sum_exp_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceLogSumExpKeepdimsRandom version: 3. func NewTestReduceLogSumExpKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceLogSumExpKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceLogSumExp", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000118a00)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000118b00)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0001e6400)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc0001e6500)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_negative_axes_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_negative_axes_keepdims_example.go new file mode 100644 index 00000000..4a59abbf --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_negative_axes_keepdims_example.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceLogSumExp", "TestReduceLogSumExpNegativeAxesKeepdimsExample", NewTestReduceLogSumExpNegativeAxesKeepdimsExample) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceLogSumExp", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_log_sum_exp_negative_axes_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceLogSumExpNegativeAxesKeepdimsExample version: 6. +func NewTestReduceLogSumExpNegativeAxesKeepdimsExample() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceLogSumExp", + Title: "TestReduceLogSumExpNegativeAxesKeepdimsExample", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xbc, 0x1, 0xa, 0x47, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0xf, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x4c, 0x6f, 0x67, 0x53, 0x75, 0x6d, 0x45, 0x78, 0x70, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x36, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x73, 0x75, 0x6d, 0x5f, 0x65, 0x78, 0x70, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceLogSumExp", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000216c00)(name:"axes" type:INTS ints:-2 ), + (*ir.AttributeProto)(0xc000216d00)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{5, 1, 20, 2, 30, 1, 40, 2, 55, 1, 60, 2}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 1, 2), + tensor.WithBacking([]float32{20, 2.3132617, 40.000046, 2.3132617, 60.006714, 2.3132617}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_negative_axes_keepdims_example_test.go b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_negative_axes_keepdims_example_test.go new file mode 100644 index 00000000..a1f72d01 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_negative_axes_keepdims_example_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceLogSumExpNegativeAxesKeepdimsExample(t *testing.T) { + mytest := NewTestReduceLogSumExpNegativeAxesKeepdimsExample() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_negative_axes_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_negative_axes_keepdims_random.go new file mode 100644 index 00000000..9003a948 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_negative_axes_keepdims_random.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceLogSumExp", "TestReduceLogSumExpNegativeAxesKeepdimsRandom", NewTestReduceLogSumExpNegativeAxesKeepdimsRandom) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceLogSumExp", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_log_sum_exp_negative_axes_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceLogSumExpNegativeAxesKeepdimsRandom version: 6. +func NewTestReduceLogSumExpNegativeAxesKeepdimsRandom() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceLogSumExp", + Title: "TestReduceLogSumExpNegativeAxesKeepdimsRandom", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xbb, 0x1, 0xa, 0x47, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0xf, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x4c, 0x6f, 0x67, 0x53, 0x75, 0x6d, 0x45, 0x78, 0x70, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x35, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x73, 0x75, 0x6d, 0x5f, 0x65, 0x78, 0x70, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceLogSumExp", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000217100)(name:"axes" type:INTS ints:-2 ), + (*ir.AttributeProto)(0xc000217200)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 1, 2), + tensor.WithBacking([]float32{2.3478897, 4.3364186, -0.6847583, 7.8427505, 9.304855, 0.63099027}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_negative_axes_keepdims_random_test.go b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_negative_axes_keepdims_random_test.go new file mode 100644 index 00000000..e2fb4380 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_log_sum_exp_negative_axes_keepdims_random_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceLogSumExpNegativeAxesKeepdimsRandom(t *testing.T) { + mytest := NewTestReduceLogSumExpNegativeAxesKeepdimsRandom() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_log_sum_negative_axes.go b/backend/testbackend/onnx/onnx_test_reduce_log_sum_negative_axes.go new file mode 100644 index 00000000..77a1f1df --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_log_sum_negative_axes.go @@ -0,0 +1,165 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceLogSum", "TestReduceLogSumNegativeAxes", NewTestReduceLogSumNegativeAxes) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceLogSum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_log_sum_negative_axes", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceLogSumNegativeAxes version: 6. +func NewTestReduceLogSumNegativeAxes() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceLogSum", + Title: "TestReduceLogSumNegativeAxes", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x93, 0x1, 0xa, 0x33, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0xc, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x4c, 0x6f, 0x67, 0x53, 0x75, 0x6d, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x12, 0x21, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x73, 0x75, 0x6d, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceLogSum", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217d00)(name:"axes" type:INTS ints:-2 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 5), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292, 0.11827443, 0.639921, 0.14335328, 0.9446689, 0.5218483, 0.41466194, 0.2645556, 0.7742337, 0.45615032, 0.56843394, 0.0187898, 0.6176355, 0.6120957, 0.616934, 0.94374806, 0.6818203, 0.3595079, 0.43703195, 0.6976312, 0.06022547, 0.6667667, 0.67063785, 0.21038257, 0.12892629, 0.31542835, 0.36371076, 0.57019675, 0.43860152, 0.9883738, 0.10204481, 0.20887676, 0.16130951, 0.6531083, 0.2532916, 0.46631077, 0.2444256}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 1, 5), + tensor.WithBacking([]float32{0.72926784, 0.53173923, 1.0630546, 1.166987, 0.55855495, 0.9165829, 0.8453708, 0.90794903, 1.0348058, 0.20989335, 0.566252, 0.5533817, 0.72668976, -0.057619132, 0.39459282}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_log_sum_negative_axes_test.go b/backend/testbackend/onnx/onnx_test_reduce_log_sum_negative_axes_test.go new file mode 100644 index 00000000..7f1abcab --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_log_sum_negative_axes_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceLogSumNegativeAxes(t *testing.T) { + mytest := NewTestReduceLogSumNegativeAxes() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_max_default_axes_keepdim_example.go b/backend/testbackend/onnx/onnx_test_reduce_max_default_axes_keepdim_example.go index de3fca56..7b68d863 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_max_default_axes_keepdim_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_max_default_axes_keepdim_example.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceMax", "TestReduceMaxDefaultAxesKeepdimExample", NewTestReduceMaxDefaultAxesKeepdimExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_max_default_axes_keepdim_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMaxDefaultAxesKeepdimExample version: 3. func NewTestReduceMaxDefaultAxesKeepdimExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceMaxDefaultAxesKeepdimExample() *testbackend.TestCase { Name: "", OpType: "ReduceMax", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000119100)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0002bc100)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_max_default_axes_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_max_default_axes_keepdims_random.go index 0b347c1c..14f56df3 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_max_default_axes_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_max_default_axes_keepdims_random.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceMax", "TestReduceMaxDefaultAxesKeepdimsRandom", NewTestReduceMaxDefaultAxesKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_max_default_axes_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMaxDefaultAxesKeepdimsRandom version: 3. func NewTestReduceMaxDefaultAxesKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceMaxDefaultAxesKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceMax", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000119200)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0002bc400)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_max_do_not_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_max_do_not_keepdims_example.go index 163fe235..91f2ee51 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_max_do_not_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_max_do_not_keepdims_example.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceMax", "TestReduceMaxDoNotKeepdimsExample", NewTestReduceMaxDoNotKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_max_do_not_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMaxDoNotKeepdimsExample version: 3. func NewTestReduceMaxDoNotKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceMaxDoNotKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceMax", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000119300)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000119400)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc0002bc700)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc0002bc800)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_max_do_not_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_max_do_not_keepdims_random.go index c11c8fd1..6cc79544 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_max_do_not_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_max_do_not_keepdims_random.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceMax", "TestReduceMaxDoNotKeepdimsRandom", NewTestReduceMaxDoNotKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_max_do_not_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMaxDoNotKeepdimsRandom version: 3. func NewTestReduceMaxDoNotKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceMaxDoNotKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceMax", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000234600)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000234700)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc0002bcd00)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc0002bce00)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_max_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_max_keepdims_example.go index 780870ef..ffe28186 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_max_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_max_keepdims_example.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceMax", "TestReduceMaxKeepdimsExample", NewTestReduceMaxKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_max_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMaxKeepdimsExample version: 3. func NewTestReduceMaxKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceMaxKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceMax", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000234d00)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000234e00)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000216e00)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc000216f00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_max_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_max_keepdims_random.go index a945d7a9..26c46ee8 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_max_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_max_keepdims_random.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceMax", "TestReduceMaxKeepdimsRandom", NewTestReduceMaxKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_max_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMaxKeepdimsRandom version: 3. func NewTestReduceMaxKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceMaxKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceMax", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000254000)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000254100)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217300)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc000217400)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_max_negative_axes_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_max_negative_axes_keepdims_example.go new file mode 100644 index 00000000..ac76ecc9 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_max_negative_axes_keepdims_example.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceMax", "TestReduceMaxNegativeAxesKeepdimsExample", NewTestReduceMaxNegativeAxesKeepdimsExample) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_max_negative_axes_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceMaxNegativeAxesKeepdimsExample version: 6. +func NewTestReduceMaxNegativeAxesKeepdimsExample() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceMax", + Title: "TestReduceMaxNegativeAxesKeepdimsExample", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xae, 0x1, 0xa, 0x41, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0x9, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x4d, 0x61, 0x78, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceMax", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000217f00)(name:"axes" type:INTS ints:-2 ), + (*ir.AttributeProto)(0xc0001e6100)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{5, 1, 20, 2, 30, 1, 40, 2, 55, 1, 60, 2}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 1, 2), + tensor.WithBacking([]float32{20, 2, 40, 2, 60, 2}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_max_negative_axes_keepdims_example_test.go b/backend/testbackend/onnx/onnx_test_reduce_max_negative_axes_keepdims_example_test.go new file mode 100644 index 00000000..89df8931 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_max_negative_axes_keepdims_example_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceMaxNegativeAxesKeepdimsExample(t *testing.T) { + mytest := NewTestReduceMaxNegativeAxesKeepdimsExample() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_max_negative_axes_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_max_negative_axes_keepdims_random.go new file mode 100644 index 00000000..586fc606 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_max_negative_axes_keepdims_random.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceMax", "TestReduceMaxNegativeAxesKeepdimsRandom", NewTestReduceMaxNegativeAxesKeepdimsRandom) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_max_negative_axes_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceMaxNegativeAxesKeepdimsRandom version: 6. +func NewTestReduceMaxNegativeAxesKeepdimsRandom() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceMax", + Title: "TestReduceMaxNegativeAxesKeepdimsRandom", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xad, 0x1, 0xa, 0x41, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0x9, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x4d, 0x61, 0x78, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceMax", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc0001e6700)(name:"axes" type:INTS ints:-2 ), + (*ir.AttributeProto)(0xc0002bc000)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 1, 2), + tensor.WithBacking([]float32{2.0552676, 4.303787, -1.2482557, 7.83546, 9.273255, 0.5778984}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_max_negative_axes_keepdims_random_test.go b/backend/testbackend/onnx/onnx_test_reduce_max_negative_axes_keepdims_random_test.go new file mode 100644 index 00000000..99677894 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_max_negative_axes_keepdims_random_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceMaxNegativeAxesKeepdimsRandom(t *testing.T) { + mytest := NewTestReduceMaxNegativeAxesKeepdimsRandom() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_mean_default_axes_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_mean_default_axes_keepdims_example.go index 929d5163..3935d891 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_mean_default_axes_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_mean_default_axes_keepdims_example.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceMean", "TestReduceMeanDefaultAxesKeepdimsExample", NewTestReduceMeanDefaultAxesKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMean", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_mean_default_axes_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMeanDefaultAxesKeepdimsExample version: 3. func NewTestReduceMeanDefaultAxesKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceMeanDefaultAxesKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceMean", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000254200)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0002bc400)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_mean_default_axes_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_mean_default_axes_keepdims_random.go index 931fe7f1..eca5f0d0 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_mean_default_axes_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_mean_default_axes_keepdims_random.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceMean", "TestReduceMeanDefaultAxesKeepdimsRandom", NewTestReduceMeanDefaultAxesKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMean", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_mean_default_axes_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMeanDefaultAxesKeepdimsRandom version: 3. func NewTestReduceMeanDefaultAxesKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceMeanDefaultAxesKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceMean", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000254300)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0002bc700)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_mean_do_not_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_mean_do_not_keepdims_example.go index d5b199d1..b8295dc0 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_mean_do_not_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_mean_do_not_keepdims_example.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceMean", "TestReduceMeanDoNotKeepdimsExample", NewTestReduceMeanDoNotKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMean", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_mean_do_not_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMeanDoNotKeepdimsExample version: 3. func NewTestReduceMeanDoNotKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceMeanDoNotKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceMean", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000254400)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000254500)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc0002bca00)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc0002bcb00)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_mean_do_not_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_mean_do_not_keepdims_random.go index 5b503c9b..0adff827 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_mean_do_not_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_mean_do_not_keepdims_random.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceMean", "TestReduceMeanDoNotKeepdimsRandom", NewTestReduceMeanDoNotKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMean", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_mean_do_not_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMeanDoNotKeepdimsRandom version: 3. func NewTestReduceMeanDoNotKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceMeanDoNotKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceMean", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000254b00)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000254c00)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc0002bc100)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc0002bc200)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_mean_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_mean_keepdims_example.go index 0cb9727f..2cc12ac0 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_mean_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_mean_keepdims_example.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceMean", "TestReduceMeanKeepdimsExample", NewTestReduceMeanKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMean", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_mean_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMeanKeepdimsExample version: 3. func NewTestReduceMeanKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceMeanKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceMean", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000255200)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000255300)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0002bc600)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc0002bc700)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_mean_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_mean_keepdims_random.go index 968c2892..1359ebe8 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_mean_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_mean_keepdims_random.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceMean", "TestReduceMeanKeepdimsRandom", NewTestReduceMeanKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMean", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_mean_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMeanKeepdimsRandom version: 3. func NewTestReduceMeanKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceMeanKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceMean", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132800)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000132900)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0002bcb00)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc0002bcc00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_mean_negative_axes_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_mean_negative_axes_keepdims_example.go new file mode 100644 index 00000000..603c1638 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_mean_negative_axes_keepdims_example.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceMean", "TestReduceMeanNegativeAxesKeepdimsExample", NewTestReduceMeanNegativeAxesKeepdimsExample) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMean", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_mean_negative_axes_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceMeanNegativeAxesKeepdimsExample version: 6. +func NewTestReduceMeanNegativeAxesKeepdimsExample() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceMean", + Title: "TestReduceMeanNegativeAxesKeepdimsExample", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xb0, 0x1, 0xa, 0x42, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0xa, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x4d, 0x65, 0x61, 0x6e, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceMean", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc0002bd100)(name:"axes" type:INTS ints:-2 ), + (*ir.AttributeProto)(0xc0002bd200)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{5, 1, 20, 2, 30, 1, 40, 2, 55, 1, 60, 2}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 1, 2), + tensor.WithBacking([]float32{12.5, 1.5, 35, 1.5, 57.5, 1.5}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_mean_negative_axes_keepdims_example_test.go b/backend/testbackend/onnx/onnx_test_reduce_mean_negative_axes_keepdims_example_test.go new file mode 100644 index 00000000..31dee7c3 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_mean_negative_axes_keepdims_example_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceMeanNegativeAxesKeepdimsExample(t *testing.T) { + mytest := NewTestReduceMeanNegativeAxesKeepdimsExample() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_mean_negative_axes_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_mean_negative_axes_keepdims_random.go new file mode 100644 index 00000000..041ce05e --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_mean_negative_axes_keepdims_random.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceMean", "TestReduceMeanNegativeAxesKeepdimsRandom", NewTestReduceMeanNegativeAxesKeepdimsRandom) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMean", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_mean_negative_axes_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceMeanNegativeAxesKeepdimsRandom version: 6. +func NewTestReduceMeanNegativeAxesKeepdimsRandom() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceMean", + Title: "TestReduceMeanNegativeAxesKeepdimsRandom", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xaf, 0x1, 0xa, 0x42, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0xa, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x4d, 0x65, 0x61, 0x6e, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x6d, 0x65, 0x61, 0x6e, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceMean", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc0002bd600)(name:"axes" type:INTS ints:-2 ), + (*ir.AttributeProto)(0xc0002bd700)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 1, 2), + tensor.WithBacking([]float32{1.5157688, 2.6007254, -1.3875799, 5.3766713, 7.553878, -0.8766356}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_mean_negative_axes_keepdims_random_test.go b/backend/testbackend/onnx/onnx_test_reduce_mean_negative_axes_keepdims_random_test.go new file mode 100644 index 00000000..12686328 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_mean_negative_axes_keepdims_random_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceMeanNegativeAxesKeepdimsRandom(t *testing.T) { + mytest := NewTestReduceMeanNegativeAxesKeepdimsRandom() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_min_default_axes_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_min_default_axes_keepdims_example.go index 1331ae85..8f14dfcd 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_min_default_axes_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_min_default_axes_keepdims_example.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceMin", "TestReduceMinDefaultAxesKeepdimsExample", NewTestReduceMinDefaultAxesKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_min_default_axes_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMinDefaultAxesKeepdimsExample version: 3. func NewTestReduceMinDefaultAxesKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceMinDefaultAxesKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceMin", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000132a00)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0002bdb00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_min_default_axes_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_min_default_axes_keepdims_random.go index 65dea438..36ea08d5 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_min_default_axes_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_min_default_axes_keepdims_random.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceMin", "TestReduceMinDefaultAxesKeepdimsRandom", NewTestReduceMinDefaultAxesKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_min_default_axes_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMinDefaultAxesKeepdimsRandom version: 3. func NewTestReduceMinDefaultAxesKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceMinDefaultAxesKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceMin", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000118c00)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0002bde00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_min_do_not_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_min_do_not_keepdims_example.go index a912db26..b8e231c7 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_min_do_not_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_min_do_not_keepdims_example.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceMin", "TestReduceMinDoNotKeepdimsExample", NewTestReduceMinDoNotKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_min_do_not_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMinDoNotKeepdimsExample version: 3. func NewTestReduceMinDoNotKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceMinDoNotKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceMin", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132f00)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000133000)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc000216b00)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc000216c00)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_min_do_not_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_min_do_not_keepdims_random.go index 9dc9e040..91107606 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_min_do_not_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_min_do_not_keepdims_random.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceMin", "TestReduceMinDoNotKeepdimsRandom", NewTestReduceMinDoNotKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_min_do_not_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMinDoNotKeepdimsRandom version: 3. func NewTestReduceMinDoNotKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceMinDoNotKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceMin", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000133100)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000133200)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc000217000)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc000217100)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_min_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_min_keepdims_example.go index 40e8d99f..6960afbd 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_min_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_min_keepdims_example.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceMin", "TestReduceMinKeepdimsExample", NewTestReduceMinKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_min_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMinKeepdimsExample version: 3. func NewTestReduceMinKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceMinKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceMin", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000133300)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000133400)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217c00)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc000217d00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_min_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_min_keepdims_random.go index c0f69176..abf00618 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_min_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_min_keepdims_random.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceMin", "TestReduceMinKeepdimsRandom", NewTestReduceMinKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_min_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceMinKeepdimsRandom version: 3. func NewTestReduceMinKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceMinKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceMin", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000133500)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000133600)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0001e6400)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc0001e6500)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_min_negative_axes_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_min_negative_axes_keepdims_example.go new file mode 100644 index 00000000..e5727140 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_min_negative_axes_keepdims_example.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceMin", "TestReduceMinNegativeAxesKeepdimsExample", NewTestReduceMinNegativeAxesKeepdimsExample) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_min_negative_axes_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceMinNegativeAxesKeepdimsExample version: 6. +func NewTestReduceMinNegativeAxesKeepdimsExample() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceMin", + Title: "TestReduceMinNegativeAxesKeepdimsExample", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xae, 0x1, 0xa, 0x41, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0x9, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x4d, 0x69, 0x6e, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceMin", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000240100)(name:"axes" type:INTS ints:-2 ), + (*ir.AttributeProto)(0xc000240200)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{5, 1, 20, 2, 30, 1, 40, 2, 55, 1, 60, 2}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 1, 2), + tensor.WithBacking([]float32{5, 1, 30, 1, 55, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_min_negative_axes_keepdims_example_test.go b/backend/testbackend/onnx/onnx_test_reduce_min_negative_axes_keepdims_example_test.go new file mode 100644 index 00000000..1433b26e --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_min_negative_axes_keepdims_example_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceMinNegativeAxesKeepdimsExample(t *testing.T) { + mytest := NewTestReduceMinNegativeAxesKeepdimsExample() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_min_negative_axes_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_min_negative_axes_keepdims_random.go new file mode 100644 index 00000000..e616a62f --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_min_negative_axes_keepdims_random.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceMin", "TestReduceMinNegativeAxesKeepdimsRandom", NewTestReduceMinNegativeAxesKeepdimsRandom) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceMin", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_min_negative_axes_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceMinNegativeAxesKeepdimsRandom version: 6. +func NewTestReduceMinNegativeAxesKeepdimsRandom() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceMin", + Title: "TestReduceMinNegativeAxesKeepdimsRandom", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xad, 0x1, 0xa, 0x41, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0x9, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x4d, 0x69, 0x6e, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceMin", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc000240600)(name:"axes" type:INTS ints:-2 ), + (*ir.AttributeProto)(0xc000240700)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 1, 2), + tensor.WithBacking([]float32{0.9762701, 0.89766365, -1.526904, 2.9178822, 5.834501, -2.3311696}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_min_negative_axes_keepdims_random_test.go b/backend/testbackend/onnx/onnx_test_reduce_min_negative_axes_keepdims_random_test.go new file mode 100644 index 00000000..e62aa08b --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_min_negative_axes_keepdims_random_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceMinNegativeAxesKeepdimsRandom(t *testing.T) { + mytest := NewTestReduceMinNegativeAxesKeepdimsRandom() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_prod_default_axes_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_prod_default_axes_keepdims_example.go index 106a65a9..8ceda231 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_prod_default_axes_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_prod_default_axes_keepdims_example.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceProd", "TestReduceProdDefaultAxesKeepdimsExample", NewTestReduceProdDefaultAxesKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceProd", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_prod_default_axes_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceProdDefaultAxesKeepdimsExample version: 3. func NewTestReduceProdDefaultAxesKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceProdDefaultAxesKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceProd", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000133800)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000240b00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_prod_default_axes_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_prod_default_axes_keepdims_random.go index a2a2b067..29353a5e 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_prod_default_axes_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_prod_default_axes_keepdims_random.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceProd", "TestReduceProdDefaultAxesKeepdimsRandom", NewTestReduceProdDefaultAxesKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceProd", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_prod_default_axes_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceProdDefaultAxesKeepdimsRandom version: 3. func NewTestReduceProdDefaultAxesKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceProdDefaultAxesKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceProd", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000133d00)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000240e00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_prod_do_not_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_prod_do_not_keepdims_example.go index 4e3416b8..d0a37ccd 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_prod_do_not_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_prod_do_not_keepdims_example.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceProd", "TestReduceProdDoNotKeepdimsExample", NewTestReduceProdDoNotKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceProd", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_prod_do_not_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceProdDoNotKeepdimsExample version: 3. func NewTestReduceProdDoNotKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceProdDoNotKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceProd", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000126300)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000126400)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc0001e6100)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc0001e6400)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_prod_do_not_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_prod_do_not_keepdims_random.go index bc2a753a..7556b665 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_prod_do_not_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_prod_do_not_keepdims_random.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceProd", "TestReduceProdDoNotKeepdimsRandom", NewTestReduceProdDoNotKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceProd", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_prod_do_not_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceProdDoNotKeepdimsRandom version: 3. func NewTestReduceProdDoNotKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceProdDoNotKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceProd", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc0003e8500)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc0003e8600)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc000216b00)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc000216c00)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_prod_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_prod_keepdims_example.go index d340edea..1813eea5 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_prod_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_prod_keepdims_example.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceProd", "TestReduceProdKeepdimsExample", NewTestReduceProdKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceProd", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_prod_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceProdKeepdimsExample version: 3. func NewTestReduceProdKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceProdKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceProd", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000126500)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000126600)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217000)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc000217100)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_prod_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_prod_keepdims_random.go index 8ea7c5ce..e29909f6 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_prod_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_prod_keepdims_random.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceProd", "TestReduceProdKeepdimsRandom", NewTestReduceProdKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceProd", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_prod_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceProdKeepdimsRandom version: 3. func NewTestReduceProdKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceProdKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceProd", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc0003e9100)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc0003e9200)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217c00)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc000217d00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_prod_negative_axes_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_prod_negative_axes_keepdims_example.go new file mode 100644 index 00000000..c6f53094 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_prod_negative_axes_keepdims_example.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceProd", "TestReduceProdNegativeAxesKeepdimsExample", NewTestReduceProdNegativeAxesKeepdimsExample) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceProd", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_prod_negative_axes_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceProdNegativeAxesKeepdimsExample version: 6. +func NewTestReduceProdNegativeAxesKeepdimsExample() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceProd", + Title: "TestReduceProdNegativeAxesKeepdimsExample", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xb0, 0x1, 0xa, 0x42, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0xa, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x64, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceProd", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc00025e100)(name:"axes" type:INTS ints:-2 ), + (*ir.AttributeProto)(0xc00025e200)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 1, 2), + tensor.WithBacking([]float32{3, 8, 35, 48, 99, 120}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_prod_negative_axes_keepdims_example_test.go b/backend/testbackend/onnx/onnx_test_reduce_prod_negative_axes_keepdims_example_test.go new file mode 100644 index 00000000..c9b53fb3 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_prod_negative_axes_keepdims_example_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceProdNegativeAxesKeepdimsExample(t *testing.T) { + mytest := NewTestReduceProdNegativeAxesKeepdimsExample() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_prod_negative_axes_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_prod_negative_axes_keepdims_random.go new file mode 100644 index 00000000..e004e851 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_prod_negative_axes_keepdims_random.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceProd", "TestReduceProdNegativeAxesKeepdimsRandom", NewTestReduceProdNegativeAxesKeepdimsRandom) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceProd", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_prod_negative_axes_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceProdNegativeAxesKeepdimsRandom version: 6. +func NewTestReduceProdNegativeAxesKeepdimsRandom() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceProd", + Title: "TestReduceProdNegativeAxesKeepdimsRandom", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xaf, 0x1, 0xa, 0x42, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0xa, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x64, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x64, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceProd", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc00025e600)(name:"axes" type:INTS ints:-2 ), + (*ir.AttributeProto)(0xc00025e700)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 1, 2), + tensor.WithBacking([]float32{2.0064962, 3.8633533, 1.9059666, 22.86295, 54.104816, -1.3471792}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_prod_negative_axes_keepdims_random_test.go b/backend/testbackend/onnx/onnx_test_reduce_prod_negative_axes_keepdims_random_test.go new file mode 100644 index 00000000..8b02cc2a --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_prod_negative_axes_keepdims_random_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceProdNegativeAxesKeepdimsRandom(t *testing.T) { + mytest := NewTestReduceProdNegativeAxesKeepdimsRandom() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_default_axes_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_sum_default_axes_keepdims_example.go index 56761ed4..92f92994 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_sum_default_axes_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_default_axes_keepdims_example.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceSum", "TestReduceSumDefaultAxesKeepdimsExample", NewTestReduceSumDefaultAxesKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceSum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_sum_default_axes_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceSumDefaultAxesKeepdimsExample version: 3. func NewTestReduceSumDefaultAxesKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceSumDefaultAxesKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceSum", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126c00)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc00025eb00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_default_axes_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_sum_default_axes_keepdims_random.go index 581c4349..333010c9 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_sum_default_axes_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_default_axes_keepdims_random.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceSum", "TestReduceSumDefaultAxesKeepdimsRandom", NewTestReduceSumDefaultAxesKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceSum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_sum_default_axes_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceSumDefaultAxesKeepdimsRandom version: 3. func NewTestReduceSumDefaultAxesKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceSumDefaultAxesKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceSum", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc0003e9300)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc00025ee00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_do_not_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_sum_do_not_keepdims_example.go index e7af8f4b..74641222 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_sum_do_not_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_do_not_keepdims_example.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceSum", "TestReduceSumDoNotKeepdimsExample", NewTestReduceSumDoNotKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceSum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_sum_do_not_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceSumDoNotKeepdimsExample version: 3. func NewTestReduceSumDoNotKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceSumDoNotKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceSum", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000127100)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000127200)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc00025f100)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc00025f200)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_do_not_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_sum_do_not_keepdims_random.go index 66278446..83b570b6 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_sum_do_not_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_do_not_keepdims_random.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceSum", "TestReduceSumDoNotKeepdimsRandom", NewTestReduceSumDoNotKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceSum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_sum_do_not_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceSumDoNotKeepdimsRandom version: 3. func NewTestReduceSumDoNotKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceSumDoNotKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceSum", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000127300)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000127400)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc000216e00)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc000216f00)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_sum_keepdims_example.go index 461e9c9d..984ae4fd 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_sum_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_keepdims_example.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceSum", "TestReduceSumKeepdimsExample", NewTestReduceSumKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceSum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_sum_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceSumKeepdimsExample version: 3. func NewTestReduceSumKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceSumKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceSum", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc0001f0200)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc0001f0300)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217300)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc000217400)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_sum_keepdims_random.go index fb101eeb..e6c3a093 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_sum_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_keepdims_random.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceSum", "TestReduceSumKeepdimsRandom", NewTestReduceSumKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceSum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_sum_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceSumKeepdimsRandom version: 3. func NewTestReduceSumKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceSumKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceSum", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000127500)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000127600)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000217f00)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc0001e6100)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_negative_axes_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_sum_negative_axes_keepdims_example.go new file mode 100644 index 00000000..ea95bdc5 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_negative_axes_keepdims_example.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceSum", "TestReduceSumNegativeAxesKeepdimsExample", NewTestReduceSumNegativeAxesKeepdimsExample) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceSum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_sum_negative_axes_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceSumNegativeAxesKeepdimsExample version: 6. +func NewTestReduceSumNegativeAxesKeepdimsExample() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceSum", + Title: "TestReduceSumNegativeAxesKeepdimsExample", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xae, 0x1, 0xa, 0x41, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0x9, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x53, 0x75, 0x6d, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x73, 0x75, 0x6d, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceSum", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc00025e300)(name:"axes" type:INTS ints:-2 ), + (*ir.AttributeProto)(0xc00025e400)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 1, 2), + tensor.WithBacking([]float32{4, 6, 12, 14, 20, 22}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_negative_axes_keepdims_example_test.go b/backend/testbackend/onnx/onnx_test_reduce_sum_negative_axes_keepdims_example_test.go new file mode 100644 index 00000000..87d81f18 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_negative_axes_keepdims_example_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceSumNegativeAxesKeepdimsExample(t *testing.T) { + mytest := NewTestReduceSumNegativeAxesKeepdimsExample() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_negative_axes_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_sum_negative_axes_keepdims_random.go new file mode 100644 index 00000000..8fc5c9e5 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_negative_axes_keepdims_random.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceSum", "TestReduceSumNegativeAxesKeepdimsRandom", NewTestReduceSumNegativeAxesKeepdimsRandom) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceSum", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_sum_negative_axes_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceSumNegativeAxesKeepdimsRandom version: 6. +func NewTestReduceSumNegativeAxesKeepdimsRandom() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceSum", + Title: "TestReduceSumNegativeAxesKeepdimsRandom", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xad, 0x1, 0xa, 0x41, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0x9, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x53, 0x75, 0x6d, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x73, 0x75, 0x6d, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceSum", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc00025e800)(name:"axes" type:INTS ints:-2 ), + (*ir.AttributeProto)(0xc00025e900)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 1, 2), + tensor.WithBacking([]float32{3.0315375, 5.201451, -2.7751598, 10.753343, 15.107756, -1.7532712}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_negative_axes_keepdims_random_test.go b/backend/testbackend/onnx/onnx_test_reduce_sum_negative_axes_keepdims_random_test.go new file mode 100644 index 00000000..389b546a --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_negative_axes_keepdims_random_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceSumNegativeAxesKeepdimsRandom(t *testing.T) { + mytest := NewTestReduceSumNegativeAxesKeepdimsRandom() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_square_default_axes_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_sum_square_default_axes_keepdims_example.go index 2d27acf7..ec989698 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_sum_square_default_axes_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_square_default_axes_keepdims_example.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceSumSquare", "TestReduceSumSquareDefaultAxesKeepdimsExample", NewTestReduceSumSquareDefaultAxesKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceSumSquare", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_sum_square_default_axes_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceSumSquareDefaultAxesKeepdimsExample version: 3. func NewTestReduceSumSquareDefaultAxesKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceSumSquareDefaultAxesKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceSumSquare", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc0001f0e00)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc00025ed00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_square_default_axes_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_sum_square_default_axes_keepdims_random.go index 5cc991fc..3307d04b 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_sum_square_default_axes_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_square_default_axes_keepdims_random.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ReduceSumSquare", "TestReduceSumSquareDefaultAxesKeepdimsRandom", NewTestReduceSumSquareDefaultAxesKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceSumSquare", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_sum_square_default_axes_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceSumSquareDefaultAxesKeepdimsRandom version: 3. func NewTestReduceSumSquareDefaultAxesKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestReduceSumSquareDefaultAxesKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceSumSquare", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc0001f1300)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc000216d00)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_square_do_not_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_sum_square_do_not_keepdims_example.go index ed6a0b1e..9c992887 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_sum_square_do_not_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_square_do_not_keepdims_example.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceSumSquare", "TestReduceSumSquareDoNotKeepdimsExample", NewTestReduceSumSquareDoNotKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceSumSquare", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_sum_square_do_not_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceSumSquareDoNotKeepdimsExample version: 3. func NewTestReduceSumSquareDoNotKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceSumSquareDoNotKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceSumSquare", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000127700)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000127800)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc000217000)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc000217100)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_square_do_not_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_sum_square_do_not_keepdims_random.go index d0be1c6b..adb3e96f 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_sum_square_do_not_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_square_do_not_keepdims_random.go @@ -11,6 +11,133 @@ func init() { testbackend.Register("ReduceSumSquare", "TestReduceSumSquareDoNotKeepdimsRandom", NewTestReduceSumSquareDoNotKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceSumSquare", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_sum_square_do_not_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceSumSquareDoNotKeepdimsRandom version: 3. func NewTestReduceSumSquareDoNotKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +153,8 @@ func NewTestReduceSumSquareDoNotKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceSumSquare", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc0001f1d00)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc0001f1e00)(name:"keepdims" type:INT ) + (*ir.AttributeProto)(0xc000217c00)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc000217d00)(name:"keepdims" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_square_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_sum_square_keepdims_example.go index d1c35e24..6ea5362d 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_sum_square_keepdims_example.go +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_square_keepdims_example.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceSumSquare", "TestReduceSumSquareKeepdimsExample", NewTestReduceSumSquareKeepdimsExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceSumSquare", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_sum_square_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceSumSquareKeepdimsExample version: 3. func NewTestReduceSumSquareKeepdimsExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceSumSquareKeepdimsExample() *testbackend.TestCase { Name: "", OpType: "ReduceSumSquare", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000118300)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000118400)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc0001e6400)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc0001e6500)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_square_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_sum_square_keepdims_random.go index 40105f5b..3c06df9a 100644 --- a/backend/testbackend/onnx/onnx_test_reduce_sum_square_keepdims_random.go +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_square_keepdims_random.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("ReduceSumSquare", "TestReduceSumSquareKeepdimsRandom", NewTestReduceSumSquareKeepdimsRandom) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceSumSquare", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_sum_square_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReduceSumSquareKeepdimsRandom version: 3. func NewTestReduceSumSquareKeepdimsRandom() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestReduceSumSquareKeepdimsRandom() *testbackend.TestCase { Name: "", OpType: "ReduceSumSquare", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132600)(name:"axes" type:INTS ints:1 ), - (*ir.AttributeProto)(0xc000132700)(name:"keepdims" type:INT i:1 ) + (*ir.AttributeProto)(0xc00025e100)(name:"axes" type:INTS ints:1 ), + (*ir.AttributeProto)(0xc00025e200)(name:"keepdims" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_square_negative_axes_keepdims_example.go b/backend/testbackend/onnx/onnx_test_reduce_sum_square_negative_axes_keepdims_example.go new file mode 100644 index 00000000..3fc5b97e --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_square_negative_axes_keepdims_example.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceSumSquare", "TestReduceSumSquareNegativeAxesKeepdimsExample", NewTestReduceSumSquareNegativeAxesKeepdimsExample) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceSumSquare", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_sum_square_negative_axes_keepdims_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceSumSquareNegativeAxesKeepdimsExample version: 6. +func NewTestReduceSumSquareNegativeAxesKeepdimsExample() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceSumSquare", + Title: "TestReduceSumSquareNegativeAxesKeepdimsExample", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xbb, 0x1, 0xa, 0x47, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0xf, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x53, 0x75, 0x6d, 0x53, 0x71, 0x75, 0x61, 0x72, 0x65, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x35, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x73, 0x75, 0x6d, 0x5f, 0x73, 0x71, 0x75, 0x61, 0x72, 0x65, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceSumSquare", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc00025e600)(name:"axes" type:INTS ints:-2 ), + (*ir.AttributeProto)(0xc00025e700)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 1, 2), + tensor.WithBacking([]float32{10, 20, 74, 100, 202, 244}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_square_negative_axes_keepdims_example_test.go b/backend/testbackend/onnx/onnx_test_reduce_sum_square_negative_axes_keepdims_example_test.go new file mode 100644 index 00000000..07d1d567 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_square_negative_axes_keepdims_example_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceSumSquareNegativeAxesKeepdimsExample(t *testing.T) { + mytest := NewTestReduceSumSquareNegativeAxesKeepdimsExample() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_square_negative_axes_keepdims_random.go b/backend/testbackend/onnx/onnx_test_reduce_sum_square_negative_axes_keepdims_random.go new file mode 100644 index 00000000..6b57d1da --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_square_negative_axes_keepdims_random.go @@ -0,0 +1,184 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ReduceSumSquare", "TestReduceSumSquareNegativeAxesKeepdimsRandom", NewTestReduceSumSquareNegativeAxesKeepdimsRandom) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"reduced"}, + Name: "", + OpType: "ReduceSumSquare", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "keepdims", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reduce_sum_square_negative_axes_keepdims_random", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reduced", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReduceSumSquareNegativeAxesKeepdimsRandom version: 6. +func NewTestReduceSumSquareNegativeAxesKeepdimsRandom() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ReduceSumSquare", + Title: "TestReduceSumSquareNegativeAxesKeepdimsRandom", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xba, 0x1, 0xa, 0x47, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x22, 0xf, 0x52, 0x65, 0x64, 0x75, 0x63, 0x65, 0x53, 0x75, 0x6d, 0x53, 0x71, 0x75, 0x61, 0x72, 0x65, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x2a, 0xf, 0xa, 0x8, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x34, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x5f, 0x73, 0x75, 0x6d, 0x5f, 0x73, 0x71, 0x75, 0x61, 0x72, 0x65, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x65, 0x70, 0x64, 0x69, 0x6d, 0x73, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0x7, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data"}, + Output: []string{"reduced"}, + Name: "", + OpType: "ReduceSumSquare", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc00025eb00)(name:"axes" type:INTS ints:-2 ), + (*ir.AttributeProto)(0xc00025ec00)(name:"keepdims" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2, 2), + tensor.WithBacking([]float32{0.9762701, 4.303787, 2.0552676, 0.89766365, -1.526904, 2.9178822, -1.2482557, 7.83546, 9.273255, -2.3311696, 5.834501, 0.5778984}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 1, 2), + tensor.WithBacking([]float32{5.177228, 19.328384, 3.889578, 69.90847, 120.03467, 5.7683187}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reduce_sum_square_negative_axes_keepdims_random_test.go b/backend/testbackend/onnx/onnx_test_reduce_sum_square_negative_axes_keepdims_random_test.go new file mode 100644 index 00000000..c81cd618 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reduce_sum_square_negative_axes_keepdims_random_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReduceSumSquareNegativeAxesKeepdimsRandom(t *testing.T) { + mytest := NewTestReduceSumSquareNegativeAxesKeepdimsRandom() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reflect_pad.go b/backend/testbackend/onnx/onnx_test_reflect_pad.go index 5c86a06d..f47a9d9f 100644 --- a/backend/testbackend/onnx/onnx_test_reflect_pad.go +++ b/backend/testbackend/onnx/onnx_test_reflect_pad.go @@ -11,23 +11,163 @@ func init() { testbackend.Register("Pad", "TestReflectPad", NewTestReflectPad) } -// NewTestReflectPad version: 3. +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "pads"}, + Output: {"y"}, + Name: "", + OpType: "Pad", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "mode", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reflect_pad", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "pads", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:8}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReflectPad version: 6. func NewTestReflectPad() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "Pad", Title: "TestReflectPad", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x88, 0x1, 0xa, 0x3a, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x3, 0x50, 0x61, 0x64, 0x2a, 0x12, 0xa, 0x4, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x7, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0xa0, 0x1, 0x3, 0x2a, 0x19, 0xa, 0x4, 0x70, 0x61, 0x64, 0x73, 0x40, 0x0, 0x40, 0x0, 0x40, 0x1, 0x40, 0x1, 0x40, 0x0, 0x40, 0x0, 0x40, 0x1, 0x40, 0x1, 0xa0, 0x1, 0x7, 0x12, 0x10, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x64, 0x5a, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x7, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x87, 0x1, 0xa, 0x25, 0xa, 0x1, 0x78, 0xa, 0x4, 0x70, 0x61, 0x64, 0x73, 0x12, 0x1, 0x79, 0x22, 0x3, 0x50, 0x61, 0x64, 0x2a, 0x12, 0xa, 0x4, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x7, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0xa0, 0x1, 0x3, 0x12, 0x10, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x66, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x64, 0x5a, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x16, 0xa, 0x14, 0x8, 0x6, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x5a, 0x12, 0xa, 0x4, 0x70, 0x61, 0x64, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x8, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x6, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x7, 0x42, 0x2, 0x10, 0xb}, /* &ir.NodeProto{ - Input: []string{"x"}, + Input: []string{"x", "pads"}, Output: []string{"y"}, Name: "", OpType: "Pad", - Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132d00)(name:"mode" type:STRING s:"reflect" ), - (*ir.AttributeProto)(0xc000132e00)(name:"pads" type:INTS ints:0 ints:0 ints:1 ints:1 ints:0 ints:0 ints:1 ints:1 ) + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0001e6100)(name:"mode" type:STRING s:"reflect" ) } , }, @@ -39,14 +179,19 @@ func NewTestReflectPad() *testbackend.TestCase { tensor.New( tensor.WithShape(1, 3, 4, 5), - tensor.WithBacking([]float32{-0.67246044, -0.35955316, -0.8131463, -1.7262826, 0.17742614, -0.40178093, -1.6301984, 0.46278226, -0.9072984, 0.051945396, 0.7290906, 0.12898292, 1.1394007, -1.2348258, 0.40234163, -0.6848101, -0.87079716, -0.5788497, -0.31155252, 0.05616534, -1.1651498, 0.9008265, 0.46566245, -1.5362437, 1.4882522, 1.8958892, 1.1787796, -0.17992483, -1.0707526, 1.0544517, -0.40317693, 1.222445, 0.20827498, 0.97663903, 0.3563664, 0.7065732, 0.01050002, 1.7858706, 0.12691209, 0.40198937, 1.8831507, -1.347759, -1.270485, 0.9693967, -1.1731234, 1.9436212, -0.41361898, -0.7474548, 1.922942, 1.4805148, 1.867559, 0.90604466, -0.86122566, 1.9100649, -0.26800337, 0.8024564, 0.947252, -0.15501009, 0.61407936, 0.9222067}), + tensor.WithBacking([]int32{0, 0, 0, -1, 0, 0, -1, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, -1, 1, 1, 1, 0, -1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, -1, -1, 0, -1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0}), + ), + + tensor.New( + tensor.WithShape(8), + tensor.WithBacking([]int64{0, 0, 1, 1, 0, 0, 1, 1}), ), }, ExpectedOutput: []tensor.Tensor{ tensor.New( tensor.WithShape(1, 3, 6, 7), - tensor.WithBacking([]float32{-1.6301984, -0.40178093, -1.6301984, 0.46278226, -0.9072984, 0.051945396, -0.9072984, -0.35955316, -0.67246044, -0.35955316, -0.8131463, -1.7262826, 0.17742614, -1.7262826, -1.6301984, -0.40178093, -1.6301984, 0.46278226, -0.9072984, 0.051945396, -0.9072984, 0.12898292, 0.7290906, 0.12898292, 1.1394007, -1.2348258, 0.40234163, -1.2348258, -0.87079716, -0.6848101, -0.87079716, -0.5788497, -0.31155252, 0.05616534, -0.31155252, 0.12898292, 0.7290906, 0.12898292, 1.1394007, -1.2348258, 0.40234163, -1.2348258, 1.1787796, 1.8958892, 1.1787796, -0.17992483, -1.0707526, 1.0544517, -1.0707526, 0.9008265, -1.1651498, 0.9008265, 0.46566245, -1.5362437, 1.4882522, -1.5362437, 1.1787796, 1.8958892, 1.1787796, -0.17992483, -1.0707526, 1.0544517, -1.0707526, 1.222445, -0.40317693, 1.222445, 0.20827498, 0.97663903, 0.3563664, 0.97663903, 0.01050002, 0.7065732, 0.01050002, 1.7858706, 0.12691209, 0.40198937, 0.12691209, 1.222445, -0.40317693, 1.222445, 0.20827498, 0.97663903, 0.3563664, 0.97663903, -0.41361898, 1.9436212, -0.41361898, -0.7474548, 1.922942, 1.4805148, 1.922942, -1.347759, 1.8831507, -1.347759, -1.270485, 0.9693967, -1.1731234, 0.9693967, -0.41361898, 1.9436212, -0.41361898, -0.7474548, 1.922942, 1.4805148, 1.922942, 0.90604466, 1.867559, 0.90604466, -0.86122566, 1.9100649, -0.26800337, 1.9100649, 0.947252, 0.8024564, 0.947252, -0.15501009, 0.61407936, 0.9222067, 0.61407936, 0.90604466, 1.867559, 0.90604466, -0.86122566, 1.9100649, -0.26800337, 1.9100649}), + tensor.WithBacking([]int32{-1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, -1, 1, 1, 1, 0, -1, 1, -1, 0, -1, 0, 0, -1, 1, -1, 1, 1, 1, 0, -1, 1, -1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, -1, 1, -1, -1, 0, -1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1}), ), }, } diff --git a/backend/testbackend/onnx/onnx_test_relu.go b/backend/testbackend/onnx/onnx_test_relu.go index 61ed3483..b12b04ab 100644 --- a/backend/testbackend/onnx/onnx_test_relu.go +++ b/backend/testbackend/onnx/onnx_test_relu.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Relu", "TestRelu", NewTestRelu) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Relu", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_relu", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestRelu version: 3. func NewTestRelu() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_reshape_extended_dims.go b/backend/testbackend/onnx/onnx_test_reshape_extended_dims.go index bce7e4e7..edcf171e 100644 --- a/backend/testbackend/onnx/onnx_test_reshape_extended_dims.go +++ b/backend/testbackend/onnx/onnx_test_reshape_extended_dims.go @@ -11,12 +11,130 @@ func init() { testbackend.Register("Reshape", "TestReshapeExtendedDims", NewTestReshapeExtendedDims) } -// NewTestReshapeExtendedDims version: 3. +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "shape"}, + Output: {"reshaped"}, + Name: "", + OpType: "Reshape", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_reshape_extended_dims", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "shape", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reshaped", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReshapeExtendedDims version: 6. func NewTestReshapeExtendedDims() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "Reshape", Title: "TestReshapeExtendedDims", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x93, 0x1, 0xa, 0x20, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x22, 0x7, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x1a, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x62, 0x22, 0xa, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x93, 0x1, 0xa, 0x20, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x22, 0x7, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x1a, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x62, 0x22, 0xa, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, /* @@ -41,13 +159,13 @@ func NewTestReshapeExtendedDims() *testbackend.TestCase { tensor.New( tensor.WithShape(4), - tensor.WithBacking([]int64{3, 2, 2, 2}), + tensor.WithBacking([]int64{2, 3, 2, 2}), ), }, ExpectedOutput: []tensor.Tensor{ tensor.New( - tensor.WithShape(3, 2, 2, 2), + tensor.WithShape(2, 3, 2, 2), tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292}), ), }, diff --git a/backend/testbackend/onnx/onnx_test_reshape_negative_dim.go b/backend/testbackend/onnx/onnx_test_reshape_negative_dim.go index 027f7e30..42c8a432 100644 --- a/backend/testbackend/onnx/onnx_test_reshape_negative_dim.go +++ b/backend/testbackend/onnx/onnx_test_reshape_negative_dim.go @@ -11,12 +11,126 @@ func init() { testbackend.Register("Reshape", "TestReshapeNegativeDim", NewTestReshapeNegativeDim) } -// NewTestReshapeNegativeDim version: 3. +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "shape"}, + Output: {"reshaped"}, + Name: "", + OpType: "Reshape", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_reshape_negative_dim", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "shape", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reshaped", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReshapeNegativeDim version: 6. func NewTestReshapeNegativeDim() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "Reshape", Title: "TestReshapeNegativeDim", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x8e, 0x1, 0xa, 0x20, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x22, 0x7, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x19, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x64, 0x69, 0x6d, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0x1e, 0xa, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x8e, 0x1, 0xa, 0x20, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x22, 0x7, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x19, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x64, 0x69, 0x6d, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0x1e, 0xa, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x6, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, /* @@ -41,13 +155,13 @@ func NewTestReshapeNegativeDim() *testbackend.TestCase { tensor.New( tensor.WithShape(3), - tensor.WithBacking([]int64{6, -1, 2}), + tensor.WithBacking([]int64{2, -1, 2}), ), }, ExpectedOutput: []tensor.Tensor{ tensor.New( - tensor.WithShape(6, 2, 2), + tensor.WithShape(2, 6, 2), tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292}), ), }, diff --git a/backend/testbackend/onnx/onnx_test_reshape_negative_extended_dims.go b/backend/testbackend/onnx/onnx_test_reshape_negative_extended_dims.go new file mode 100644 index 00000000..ab4c08a1 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reshape_negative_extended_dims.go @@ -0,0 +1,173 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + //testbackend.Register("Reshape", "TestReshapeNegativeExtendedDims", NewTestReshapeNegativeExtendedDims) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "shape"}, + Output: {"reshaped"}, + Name: "", + OpType: "Reshape", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_reshape_negative_extended_dims", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "shape", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reshaped", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReshapeNegativeExtendedDims version: 6. +func NewTestReshapeNegativeExtendedDims() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Reshape", + Title: "TestReshapeNegativeExtendedDims", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x9c, 0x1, 0xa, 0x20, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x22, 0x7, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x23, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x62, 0x22, 0xa, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data", "shape"}, + Output: []string{"reshaped"}, + Name: "", + OpType: "Reshape", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292}), + ), + + tensor.New( + tensor.WithShape(4), + tensor.WithBacking([]int64{-1, 2, 3, 4}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 2, 3, 4), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reshape_negative_extended_dims_test.go b/backend/testbackend/onnx/onnx_test_reshape_negative_extended_dims_test.go new file mode 100644 index 00000000..2101e226 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reshape_negative_extended_dims_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReshapeNegativeExtendedDims(t *testing.T) { + mytest := NewTestReshapeNegativeExtendedDims() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reshape_one_dim.go b/backend/testbackend/onnx/onnx_test_reshape_one_dim.go index 9f67a585..1af32df0 100644 --- a/backend/testbackend/onnx/onnx_test_reshape_one_dim.go +++ b/backend/testbackend/onnx/onnx_test_reshape_one_dim.go @@ -8,15 +8,121 @@ import ( ) func init() { - // testbackend.Register("Reshape", "TestReshapeOneDim", NewTestReshapeOneDim) + testbackend.Register("Reshape", "TestReshapeOneDim", NewTestReshapeOneDim) } -// NewTestReshapeOneDim version: 3. +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "shape"}, + Output: {"reshaped"}, + Name: "", + OpType: "Reshape", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_reshape_one_dim", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "shape", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reshaped", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:24}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReshapeOneDim version: 6. func NewTestReshapeOneDim() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "Reshape", Title: "TestReshapeOneDim", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x81, 0x1, 0xa, 0x20, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x22, 0x7, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x14, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x6f, 0x6e, 0x65, 0x5f, 0x64, 0x69, 0x6d, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x62, 0x16, 0xa, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x18, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x81, 0x1, 0xa, 0x20, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x22, 0x7, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x14, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x6f, 0x6e, 0x65, 0x5f, 0x64, 0x69, 0x6d, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x62, 0x16, 0xa, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x18, 0x42, 0x2, 0x10, 0xb}, /* @@ -41,7 +147,7 @@ func NewTestReshapeOneDim() *testbackend.TestCase { tensor.New( tensor.WithShape(1), - tensor.WithBacking([]int{24}), + tensor.WithBacking([]float32{24}), ), }, ExpectedOutput: []tensor.Tensor{ diff --git a/backend/testbackend/onnx/onnx_test_reshape_reduced_dims.go b/backend/testbackend/onnx/onnx_test_reshape_reduced_dims.go index 02fddf33..df0dc7d1 100644 --- a/backend/testbackend/onnx/onnx_test_reshape_reduced_dims.go +++ b/backend/testbackend/onnx/onnx_test_reshape_reduced_dims.go @@ -11,12 +11,122 @@ func init() { testbackend.Register("Reshape", "TestReshapeReducedDims", NewTestReshapeReducedDims) } -// NewTestReshapeReducedDims version: 3. +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "shape"}, + Output: {"reshaped"}, + Name: "", + OpType: "Reshape", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_reshape_reduced_dims", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "shape", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reshaped", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:12}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReshapeReducedDims version: 6. func NewTestReshapeReducedDims() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "Reshape", Title: "TestReshapeReducedDims", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x8a, 0x1, 0xa, 0x20, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x22, 0x7, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x19, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1a, 0xa, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x8, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x8a, 0x1, 0xa, 0x20, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x22, 0x7, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x19, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x72, 0x65, 0x64, 0x75, 0x63, 0x65, 0x64, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1a, 0xa, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0xc, 0x42, 0x2, 0x10, 0xb}, /* @@ -41,13 +151,13 @@ func NewTestReshapeReducedDims() *testbackend.TestCase { tensor.New( tensor.WithShape(2), - tensor.WithBacking([]int64{3, 8}), + tensor.WithBacking([]int64{2, 12}), ), }, ExpectedOutput: []tensor.Tensor{ tensor.New( - tensor.WithShape(3, 8), + tensor.WithShape(2, 12), tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292}), ), }, diff --git a/backend/testbackend/onnx/onnx_test_reshape_reordered_all_dims.go b/backend/testbackend/onnx/onnx_test_reshape_reordered_all_dims.go new file mode 100644 index 00000000..5583ee62 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reshape_reordered_all_dims.go @@ -0,0 +1,169 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Reshape", "TestReshapeReorderedAllDims", NewTestReshapeReorderedAllDims) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "shape"}, + Output: {"reshaped"}, + Name: "", + OpType: "Reshape", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_reshape_reordered_all_dims", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "shape", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reshaped", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReshapeReorderedAllDims version: 6. +func NewTestReshapeReorderedAllDims() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Reshape", + Title: "TestReshapeReorderedAllDims", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x94, 0x1, 0xa, 0x20, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x22, 0x7, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x1f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x72, 0x65, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x61, 0x6c, 0x6c, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0x1e, 0xa, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data", "shape"}, + Output: []string{"reshaped"}, + Name: "", + OpType: "Reshape", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292}), + ), + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]int64{4, 2, 3}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(4, 2, 3), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reshape_reordered_all_dims_test.go b/backend/testbackend/onnx/onnx_test_reshape_reordered_all_dims_test.go new file mode 100644 index 00000000..b3c87062 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reshape_reordered_all_dims_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReshapeReorderedAllDims(t *testing.T) { + mytest := NewTestReshapeReorderedAllDims() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reshape_reordered_dims.go b/backend/testbackend/onnx/onnx_test_reshape_reordered_dims.go deleted file mode 100644 index 22f81548..00000000 --- a/backend/testbackend/onnx/onnx_test_reshape_reordered_dims.go +++ /dev/null @@ -1,55 +0,0 @@ -package onnxtest - -// this file is auto-generated... DO NOT EDIT - -import ( - "github.com/owulveryck/onnx-go/backend/testbackend" - "gorgonia.org/tensor" -) - -func init() { - testbackend.Register("Reshape", "TestReshapeReorderedDims", NewTestReshapeReorderedDims) -} - -// NewTestReshapeReorderedDims version: 3. -func NewTestReshapeReorderedDims() *testbackend.TestCase { - return &testbackend.TestCase{ - OpType: "Reshape", - Title: "TestReshapeReorderedDims", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x90, 0x1, 0xa, 0x20, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x22, 0x7, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x1b, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x72, 0x65, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0x1e, 0xa, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0x9}, - - /* - - &ir.NodeProto{ - Input: []string{"data", "shape"}, - Output: []string{"reshaped"}, - Name: "", - OpType: "Reshape", - Attributes: ([]*ir.AttributeProto) - , - }, - - - */ - - Input: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(2, 3, 4), - tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292}), - ), - - tensor.New( - tensor.WithShape(3), - tensor.WithBacking([]int64{4, 2, 3}), - ), - }, - ExpectedOutput: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(4, 2, 3), - tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292}), - ), - }, - } -} diff --git a/backend/testbackend/onnx/onnx_test_reshape_reordered_dims_test.go b/backend/testbackend/onnx/onnx_test_reshape_reordered_dims_test.go deleted file mode 100644 index aefec7be..00000000 --- a/backend/testbackend/onnx/onnx_test_reshape_reordered_dims_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package onnxtest - -import ( - "testing" - - "github.com/gogo/protobuf/proto" - "github.com/owulveryck/onnx-go/internal/onnx/ir" -) - -func TestNewTestReshapeReorderedDims(t *testing.T) { - mytest := NewTestReshapeReorderedDims() - var model ir.ModelProto - err := proto.Unmarshal(mytest.ModelB, &model) - if err != nil { - t.Fatal(err) - } - if model.Graph == nil { - t.Fatal("graph is nil") - } - if len(model.Graph.Input) != len(mytest.Input) { - t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) - } - if len(model.Graph.Output) != len(mytest.ExpectedOutput) { - t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) - } -} diff --git a/backend/testbackend/onnx/onnx_test_reshape_reordered_last_dims.go b/backend/testbackend/onnx/onnx_test_reshape_reordered_last_dims.go new file mode 100644 index 00000000..6376d63a --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reshape_reordered_last_dims.go @@ -0,0 +1,169 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Reshape", "TestReshapeReorderedLastDims", NewTestReshapeReorderedLastDims) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "shape"}, + Output: {"reshaped"}, + Name: "", + OpType: "Reshape", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_reshape_reordered_last_dims", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "shape", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reshaped", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReshapeReorderedLastDims version: 6. +func NewTestReshapeReorderedLastDims() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Reshape", + Title: "TestReshapeReorderedLastDims", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x95, 0x1, 0xa, 0x20, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x22, 0x7, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x20, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x72, 0x65, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x65, 0x64, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x64, 0x69, 0x6d, 0x73, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0x1e, 0xa, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data", "shape"}, + Output: []string{"reshaped"}, + Name: "", + OpType: "Reshape", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292}), + ), + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]int64{2, 4, 3}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 4, 3), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reshape_reordered_last_dims_test.go b/backend/testbackend/onnx/onnx_test_reshape_reordered_last_dims_test.go new file mode 100644 index 00000000..3a58399e --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reshape_reordered_last_dims_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReshapeReorderedLastDims(t *testing.T) { + mytest := NewTestReshapeReorderedLastDims() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reshape_zero_and_negative_dim.go b/backend/testbackend/onnx/onnx_test_reshape_zero_and_negative_dim.go new file mode 100644 index 00000000..0e441a7c --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reshape_zero_and_negative_dim.go @@ -0,0 +1,173 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + //testbackend.Register("Reshape", "TestReshapeZeroAndNegativeDim", NewTestReshapeZeroAndNegativeDim) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "shape"}, + Output: {"reshaped"}, + Name: "", + OpType: "Reshape", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_reshape_zero_and_negative_dim", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "shape", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reshaped", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReshapeZeroAndNegativeDim version: 6. +func NewTestReshapeZeroAndNegativeDim() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Reshape", + Title: "TestReshapeZeroAndNegativeDim", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x9b, 0x1, 0xa, 0x20, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x22, 0x7, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x22, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x7a, 0x65, 0x72, 0x6f, 0x5f, 0x61, 0x6e, 0x64, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x64, 0x69, 0x6d, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x62, 0x22, 0xa, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data", "shape"}, + Output: []string{"reshaped"}, + Name: "", + OpType: "Reshape", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292}), + ), + + tensor.New( + tensor.WithShape(4), + tensor.WithBacking([]int64{2, 0, 1, -1}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 1, 4), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reshape_zero_and_negative_dim_test.go b/backend/testbackend/onnx/onnx_test_reshape_zero_and_negative_dim_test.go new file mode 100644 index 00000000..211be5bb --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reshape_zero_and_negative_dim_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReshapeZeroAndNegativeDim(t *testing.T) { + mytest := NewTestReshapeZeroAndNegativeDim() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_reshape_zero_dim.go b/backend/testbackend/onnx/onnx_test_reshape_zero_dim.go new file mode 100644 index 00000000..3d3bf2a5 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reshape_zero_dim.go @@ -0,0 +1,173 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Reshape", "TestReshapeZeroDim", NewTestReshapeZeroDim) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "shape"}, + Output: {"reshaped"}, + Name: "", + OpType: "Reshape", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_reshape_zero_dim", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "shape", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "reshaped", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestReshapeZeroDim version: 6. +func NewTestReshapeZeroDim() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Reshape", + Title: "TestReshapeZeroDim", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x8e, 0x1, 0xa, 0x20, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x22, 0x7, 0x52, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x5f, 0x7a, 0x65, 0x72, 0x6f, 0x5f, 0x64, 0x69, 0x6d, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x13, 0xa, 0x5, 0x73, 0x68, 0x61, 0x70, 0x65, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x62, 0x22, 0xa, 0x8, 0x72, 0x65, 0x73, 0x68, 0x61, 0x70, 0x65, 0x64, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data", "shape"}, + Output: []string{"reshaped"}, + Name: "", + OpType: "Reshape", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292}), + ), + + tensor.New( + tensor.WithShape(4), + tensor.WithBacking([]int64{2, 0, 4, 1}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 4, 1), + tensor.WithBacking([]float32{0.5488135, 0.71518934, 0.60276335, 0.5448832, 0.4236548, 0.6458941, 0.4375872, 0.891773, 0.96366274, 0.3834415, 0.79172504, 0.5288949, 0.56804454, 0.92559665, 0.071036056, 0.0871293, 0.020218397, 0.83261985, 0.77815676, 0.87001216, 0.9786183, 0.7991586, 0.46147937, 0.7805292}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_reshape_zero_dim_test.go b/backend/testbackend/onnx/onnx_test_reshape_zero_dim_test.go new file mode 100644 index 00000000..e16fc84e --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_reshape_zero_dim_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestReshapeZeroDim(t *testing.T) { + mytest := NewTestReshapeZeroDim() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_resize_downsample_linear.go b/backend/testbackend/onnx/onnx_test_resize_downsample_linear.go deleted file mode 100644 index d2671cf3..00000000 --- a/backend/testbackend/onnx/onnx_test_resize_downsample_linear.go +++ /dev/null @@ -1,57 +0,0 @@ -package onnxtest - -// this file is auto-generated... DO NOT EDIT - -import ( - "github.com/owulveryck/onnx-go/backend/testbackend" - "gorgonia.org/tensor" -) - -func init() { - testbackend.Register("Resize", "TestResizeDownsampleLinear", NewTestResizeDownsampleLinear) -} - -// NewTestResizeDownsampleLinear version: 4. -func NewTestResizeDownsampleLinear() *testbackend.TestCase { - return &testbackend.TestCase{ - OpType: "Resize", - Title: "TestResizeDownsampleLinear", - ModelB: []byte{0x8, 0x4, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x9a, 0x1, 0xa, 0x29, 0xa, 0x1, 0x58, 0xa, 0x6, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x12, 0x1, 0x59, 0x22, 0x6, 0x52, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x2a, 0x11, 0xa, 0x4, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x6, 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0xa0, 0x1, 0x3, 0x12, 0x1d, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x64, 0x6f, 0x77, 0x6e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x5a, 0x1b, 0xa, 0x1, 0x58, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x14, 0xa, 0x6, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x62, 0x1b, 0xa, 0x1, 0x59, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xa}, - - /* - - &ir.NodeProto{ - Input: []string{"X", "scales"}, - Output: []string{"Y"}, - Name: "", - OpType: "Resize", - Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000119400)(name:"mode" type:STRING s:"linear" ) - } - , - }, - - - */ - - Input: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(1, 1, 2, 4), - tensor.WithBacking([]float32{1, 2, 3, 4, 5, 6, 7, 8}), - ), - - tensor.New( - tensor.WithShape(4), - tensor.WithBacking([]float32{1, 1, 0.6, 0.6}), - ), - }, - ExpectedOutput: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(1, 1, 1, 2), - tensor.WithBacking([]float32{1, 2.6666665}), - ), - }, - } -} diff --git a/backend/testbackend/onnx/onnx_test_resize_downsample_linear_test.go b/backend/testbackend/onnx/onnx_test_resize_downsample_linear_test.go deleted file mode 100644 index eab732d9..00000000 --- a/backend/testbackend/onnx/onnx_test_resize_downsample_linear_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package onnxtest - -import ( - "testing" - - "github.com/gogo/protobuf/proto" - "github.com/owulveryck/onnx-go/internal/onnx/ir" -) - -func TestNewTestResizeDownsampleLinear(t *testing.T) { - mytest := NewTestResizeDownsampleLinear() - var model ir.ModelProto - err := proto.Unmarshal(mytest.ModelB, &model) - if err != nil { - t.Fatal(err) - } - if model.Graph == nil { - t.Fatal("graph is nil") - } - if len(model.Graph.Input) != len(mytest.Input) { - t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) - } - if len(model.Graph.Output) != len(mytest.ExpectedOutput) { - t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) - } -} diff --git a/backend/testbackend/onnx/onnx_test_resize_downsample_nearest.go b/backend/testbackend/onnx/onnx_test_resize_downsample_nearest.go deleted file mode 100644 index b07b6e7d..00000000 --- a/backend/testbackend/onnx/onnx_test_resize_downsample_nearest.go +++ /dev/null @@ -1,57 +0,0 @@ -package onnxtest - -// this file is auto-generated... DO NOT EDIT - -import ( - "github.com/owulveryck/onnx-go/backend/testbackend" - "gorgonia.org/tensor" -) - -func init() { - testbackend.Register("Resize", "TestResizeDownsampleNearest", NewTestResizeDownsampleNearest) -} - -// NewTestResizeDownsampleNearest version: 4. -func NewTestResizeDownsampleNearest() *testbackend.TestCase { - return &testbackend.TestCase{ - OpType: "Resize", - Title: "TestResizeDownsampleNearest", - ModelB: []byte{0x8, 0x4, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x9c, 0x1, 0xa, 0x2a, 0xa, 0x1, 0x58, 0xa, 0x6, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x12, 0x1, 0x59, 0x22, 0x6, 0x52, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x2a, 0x12, 0xa, 0x4, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x7, 0x6e, 0x65, 0x61, 0x72, 0x65, 0x73, 0x74, 0xa0, 0x1, 0x3, 0x12, 0x1e, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x64, 0x6f, 0x77, 0x6e, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x6e, 0x65, 0x61, 0x72, 0x65, 0x73, 0x74, 0x5a, 0x1b, 0xa, 0x1, 0x58, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x14, 0xa, 0x6, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x62, 0x1b, 0xa, 0x1, 0x59, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xa}, - - /* - - &ir.NodeProto{ - Input: []string{"X", "scales"}, - Output: []string{"Y"}, - Name: "", - OpType: "Resize", - Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000127200)(name:"mode" type:STRING s:"nearest" ) - } - , - }, - - - */ - - Input: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(1, 1, 2, 4), - tensor.WithBacking([]float32{1, 2, 3, 4, 5, 6, 7, 8}), - ), - - tensor.New( - tensor.WithShape(4), - tensor.WithBacking([]float32{1, 1, 0.6, 0.6}), - ), - }, - ExpectedOutput: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(1, 1, 1, 2), - tensor.WithBacking([]float32{1, 3}), - ), - }, - } -} diff --git a/backend/testbackend/onnx/onnx_test_resize_downsample_nearest_test.go b/backend/testbackend/onnx/onnx_test_resize_downsample_nearest_test.go deleted file mode 100644 index ca8857b8..00000000 --- a/backend/testbackend/onnx/onnx_test_resize_downsample_nearest_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package onnxtest - -import ( - "testing" - - "github.com/gogo/protobuf/proto" - "github.com/owulveryck/onnx-go/internal/onnx/ir" -) - -func TestNewTestResizeDownsampleNearest(t *testing.T) { - mytest := NewTestResizeDownsampleNearest() - var model ir.ModelProto - err := proto.Unmarshal(mytest.ModelB, &model) - if err != nil { - t.Fatal(err) - } - if model.Graph == nil { - t.Fatal("graph is nil") - } - if len(model.Graph.Input) != len(mytest.Input) { - t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) - } - if len(model.Graph.Output) != len(mytest.ExpectedOutput) { - t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) - } -} diff --git a/backend/testbackend/onnx/onnx_test_resize_nearest.go b/backend/testbackend/onnx/onnx_test_resize_nearest.go deleted file mode 100644 index 7a5c6db0..00000000 --- a/backend/testbackend/onnx/onnx_test_resize_nearest.go +++ /dev/null @@ -1,57 +0,0 @@ -package onnxtest - -// this file is auto-generated... DO NOT EDIT - -import ( - "github.com/owulveryck/onnx-go/backend/testbackend" - "gorgonia.org/tensor" -) - -func init() { - testbackend.Register("Resize", "TestResizeNearest", NewTestResizeNearest) -} - -// NewTestResizeNearest version: 4. -func NewTestResizeNearest() *testbackend.TestCase { - return &testbackend.TestCase{ - OpType: "Resize", - Title: "TestResizeNearest", - ModelB: []byte{0x8, 0x4, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x91, 0x1, 0xa, 0x2a, 0xa, 0x1, 0x58, 0xa, 0x6, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x12, 0x1, 0x59, 0x22, 0x6, 0x52, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x2a, 0x12, 0xa, 0x4, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x7, 0x6e, 0x65, 0x61, 0x72, 0x65, 0x73, 0x74, 0xa0, 0x1, 0x3, 0x12, 0x13, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x6e, 0x65, 0x61, 0x72, 0x65, 0x73, 0x74, 0x5a, 0x1b, 0xa, 0x1, 0x58, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x14, 0xa, 0x6, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x62, 0x1b, 0xa, 0x1, 0x59, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xa}, - - /* - - &ir.NodeProto{ - Input: []string{"X", "scales"}, - Output: []string{"Y"}, - Name: "", - OpType: "Resize", - Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000127700)(name:"mode" type:STRING s:"nearest" ) - } - , - }, - - - */ - - Input: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(1, 1, 2, 4), - tensor.WithBacking([]float32{1, 2, 3, 4, 5, 6, 7, 8}), - ), - - tensor.New( - tensor.WithShape(4), - tensor.WithBacking([]float32{1, 1, 0.6, 0.6}), - ), - }, - ExpectedOutput: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(1, 1, 1, 2), - tensor.WithBacking([]float32{1, 3}), - ), - }, - } -} diff --git a/backend/testbackend/onnx/onnx_test_resize_upsample_linear.go b/backend/testbackend/onnx/onnx_test_resize_upsample_linear.go deleted file mode 100644 index fbfbe2f7..00000000 --- a/backend/testbackend/onnx/onnx_test_resize_upsample_linear.go +++ /dev/null @@ -1,57 +0,0 @@ -package onnxtest - -// this file is auto-generated... DO NOT EDIT - -import ( - "github.com/owulveryck/onnx-go/backend/testbackend" - "gorgonia.org/tensor" -) - -func init() { - testbackend.Register("Resize", "TestResizeUpsampleLinear", NewTestResizeUpsampleLinear) -} - -// NewTestResizeUpsampleLinear version: 4. -func NewTestResizeUpsampleLinear() *testbackend.TestCase { - return &testbackend.TestCase{ - OpType: "Resize", - Title: "TestResizeUpsampleLinear", - ModelB: []byte{0x8, 0x4, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x98, 0x1, 0xa, 0x29, 0xa, 0x1, 0x58, 0xa, 0x6, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x12, 0x1, 0x59, 0x22, 0x6, 0x52, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x2a, 0x11, 0xa, 0x4, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x6, 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0xa0, 0x1, 0x3, 0x12, 0x1b, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x75, 0x70, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x5a, 0x1b, 0xa, 0x1, 0x58, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x14, 0xa, 0x6, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x62, 0x1b, 0xa, 0x1, 0x59, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xa}, - - /* - - &ir.NodeProto{ - Input: []string{"X", "scales"}, - Output: []string{"Y"}, - Name: "", - OpType: "Resize", - Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000119500)(name:"mode" type:STRING s:"linear" ) - } - , - }, - - - */ - - Input: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(1, 1, 2, 2), - tensor.WithBacking([]float32{1, 2, 3, 4}), - ), - - tensor.New( - tensor.WithShape(4), - tensor.WithBacking([]float32{1, 1, 2, 2}), - ), - }, - ExpectedOutput: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(1, 1, 4, 4), - tensor.WithBacking([]float32{1, 1.5, 2, 2, 2, 2.5, 3, 3, 3, 3.5, 4, 4, 3, 3.5, 4, 4}), - ), - }, - } -} diff --git a/backend/testbackend/onnx/onnx_test_resize_upsample_linear_test.go b/backend/testbackend/onnx/onnx_test_resize_upsample_linear_test.go deleted file mode 100644 index d8d7f266..00000000 --- a/backend/testbackend/onnx/onnx_test_resize_upsample_linear_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package onnxtest - -import ( - "testing" - - "github.com/gogo/protobuf/proto" - "github.com/owulveryck/onnx-go/internal/onnx/ir" -) - -func TestNewTestResizeUpsampleLinear(t *testing.T) { - mytest := NewTestResizeUpsampleLinear() - var model ir.ModelProto - err := proto.Unmarshal(mytest.ModelB, &model) - if err != nil { - t.Fatal(err) - } - if model.Graph == nil { - t.Fatal("graph is nil") - } - if len(model.Graph.Input) != len(mytest.Input) { - t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) - } - if len(model.Graph.Output) != len(mytest.ExpectedOutput) { - t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) - } -} diff --git a/backend/testbackend/onnx/onnx_test_resize_upsample_nearest.go b/backend/testbackend/onnx/onnx_test_resize_upsample_nearest.go deleted file mode 100644 index 470d0d2a..00000000 --- a/backend/testbackend/onnx/onnx_test_resize_upsample_nearest.go +++ /dev/null @@ -1,57 +0,0 @@ -package onnxtest - -// this file is auto-generated... DO NOT EDIT - -import ( - "github.com/owulveryck/onnx-go/backend/testbackend" - "gorgonia.org/tensor" -) - -func init() { - testbackend.Register("Resize", "TestResizeUpsampleNearest", NewTestResizeUpsampleNearest) -} - -// NewTestResizeUpsampleNearest version: 4. -func NewTestResizeUpsampleNearest() *testbackend.TestCase { - return &testbackend.TestCase{ - OpType: "Resize", - Title: "TestResizeUpsampleNearest", - ModelB: []byte{0x8, 0x4, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x9a, 0x1, 0xa, 0x2a, 0xa, 0x1, 0x58, 0xa, 0x6, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x12, 0x1, 0x59, 0x22, 0x6, 0x52, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x2a, 0x12, 0xa, 0x4, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x7, 0x6e, 0x65, 0x61, 0x72, 0x65, 0x73, 0x74, 0xa0, 0x1, 0x3, 0x12, 0x1c, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x75, 0x70, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x5f, 0x6e, 0x65, 0x61, 0x72, 0x65, 0x73, 0x74, 0x5a, 0x1b, 0xa, 0x1, 0x58, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x14, 0xa, 0x6, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x62, 0x1b, 0xa, 0x1, 0x59, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x6, 0x42, 0x2, 0x10, 0xa}, - - /* - - &ir.NodeProto{ - Input: []string{"X", "scales"}, - Output: []string{"Y"}, - Name: "", - OpType: "Resize", - Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000358200)(name:"mode" type:STRING s:"nearest" ) - } - , - }, - - - */ - - Input: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(1, 1, 2, 2), - tensor.WithBacking([]float32{1, 2, 3, 4}), - ), - - tensor.New( - tensor.WithShape(4), - tensor.WithBacking([]float32{1, 1, 2, 3}), - ), - }, - ExpectedOutput: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(1, 1, 4, 6), - tensor.WithBacking([]float32{1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 3, 3, 3, 4, 4, 4}), - ), - }, - } -} diff --git a/backend/testbackend/onnx/onnx_test_resize_upsample_nearest_test.go b/backend/testbackend/onnx/onnx_test_resize_upsample_nearest_test.go deleted file mode 100644 index b928bb82..00000000 --- a/backend/testbackend/onnx/onnx_test_resize_upsample_nearest_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package onnxtest - -import ( - "testing" - - "github.com/gogo/protobuf/proto" - "github.com/owulveryck/onnx-go/internal/onnx/ir" -) - -func TestNewTestResizeUpsampleNearest(t *testing.T) { - mytest := NewTestResizeUpsampleNearest() - var model ir.ModelProto - err := proto.Unmarshal(mytest.ModelB, &model) - if err != nil { - t.Fatal(err) - } - if model.Graph == nil { - t.Fatal("graph is nil") - } - if len(model.Graph.Input) != len(mytest.Input) { - t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) - } - if len(model.Graph.Output) != len(mytest.ExpectedOutput) { - t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) - } -} diff --git a/backend/testbackend/onnx/onnx_test_reversesequence_batch.go b/backend/testbackend/onnx/onnx_test_reversesequence_batch.go index 21b9493a..19574422 100644 --- a/backend/testbackend/onnx/onnx_test_reversesequence_batch.go +++ b/backend/testbackend/onnx/onnx_test_reversesequence_batch.go @@ -11,6 +11,149 @@ func init() { testbackend.Register("ReverseSequence", "TestReversesequenceBatch", NewTestReversesequenceBatch) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "sequence_lens"}, + Output: {"y"}, + Name: "", + OpType: "ReverseSequence", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "batch_axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "time_axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reversesequence_batch", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "sequence_lens", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReversesequenceBatch version: 5. func NewTestReversesequenceBatch() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +169,8 @@ func NewTestReversesequenceBatch() *testbackend.TestCase { Name: "", OpType: "ReverseSequence", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000358700)(name:"batch_axis" type:INT ), - (*ir.AttributeProto)(0xc000358800)(name:"time_axis" type:INT i:1 ) + (*ir.AttributeProto)(0xc0002ca900)(name:"batch_axis" type:INT ), + (*ir.AttributeProto)(0xc0002caa00)(name:"time_axis" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_reversesequence_time.go b/backend/testbackend/onnx/onnx_test_reversesequence_time.go index ef9decef..8c37dd0e 100644 --- a/backend/testbackend/onnx/onnx_test_reversesequence_time.go +++ b/backend/testbackend/onnx/onnx_test_reversesequence_time.go @@ -11,6 +11,149 @@ func init() { testbackend.Register("ReverseSequence", "TestReversesequenceTime", NewTestReversesequenceTime) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "sequence_lens"}, + Output: {"y"}, + Name: "", + OpType: "ReverseSequence", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "batch_axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "time_axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_reversesequence_time", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "sequence_lens", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestReversesequenceTime version: 5. func NewTestReversesequenceTime() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +169,8 @@ func NewTestReversesequenceTime() *testbackend.TestCase { Name: "", OpType: "ReverseSequence", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000358a00)(name:"batch_axis" type:INT i:1 ), - (*ir.AttributeProto)(0xc000358b00)(name:"time_axis" type:INT ) + (*ir.AttributeProto)(0xc0002cb100)(name:"batch_axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc0002cb200)(name:"time_axis" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_roialign.go b/backend/testbackend/onnx/onnx_test_roialign.go index 232c2789..b84d4709 100644 --- a/backend/testbackend/onnx/onnx_test_roialign.go +++ b/backend/testbackend/onnx/onnx_test_roialign.go @@ -11,6 +11,225 @@ func init() { testbackend.Register("RoiAlign", "TestRoialign", NewTestRoialign) } +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X", "rois", "batch_indices"}, + Output: {"Y"}, + Name: "", + OpType: "RoiAlign", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "output_height", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 5, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "output_width", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 5, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "sampling_ratio", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "spatial_scale", + RefAttrName: "", + DocString: "", + Type: 1, + F: 1, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_roialign", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "rois", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "batch_indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestRoialign version: 5. func NewTestRoialign() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,10 +245,10 @@ func NewTestRoialign() *testbackend.TestCase { Name: "", OpType: "RoiAlign", Attributes: ([]*ir.AttributeProto) (len=4 cap=4) { - (*ir.AttributeProto)(0xc000236300)(name:"output_height" type:INT i:5 ), - (*ir.AttributeProto)(0xc000236400)(name:"output_width" type:INT i:5 ), - (*ir.AttributeProto)(0xc000236500)(name:"sampling_ratio" type:INT i:2 ), - (*ir.AttributeProto)(0xc000236600)(name:"spatial_scale" type:FLOAT f:1 ) + (*ir.AttributeProto)(0xc0002cb900)(name:"output_height" type:INT i:5 ), + (*ir.AttributeProto)(0xc0002cba00)(name:"output_width" type:INT i:5 ), + (*ir.AttributeProto)(0xc0002cbb00)(name:"sampling_ratio" type:INT i:2 ), + (*ir.AttributeProto)(0xc0002cbc00)(name:"spatial_scale" type:FLOAT f:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_round.go b/backend/testbackend/onnx/onnx_test_round.go new file mode 100644 index 00000000..a85d6204 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_round.go @@ -0,0 +1,128 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Round", "TestRound", NewTestRound) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Round", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_round", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:15}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:15}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestRound version: 5. +func NewTestRound() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Round", + Title: "TestRound", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x3d, 0xa, 0xd, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x5, 0x52, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0xa, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x5a, 0xf, 0xa, 0x1, 0x78, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0xf, 0x62, 0xf, 0xa, 0x1, 0x79, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0xf, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Round", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(15), + tensor.WithBacking([]float32{0.1, 0.5, 0.9, 1.2, 1.5, 1.8, 2.3, 2.5, 2.7, -1.1, -1.5, -1.9, -2.2, -2.5, -2.8}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(15), + tensor.WithBacking([]float32{0, 0, 1, 1, 2, 2, 2, 2, 3, -1, -2, -2, -2, -2, -3}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_round_test.go b/backend/testbackend/onnx/onnx_test_round_test.go new file mode 100644 index 00000000..7f04c814 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_round_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestRound(t *testing.T) { + mytest := NewTestRound() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_scan9_sum.go b/backend/testbackend/onnx/onnx_test_scan9_sum.go index de1f7c83..1b44c15a 100644 --- a/backend/testbackend/onnx/onnx_test_scan9_sum.go +++ b/backend/testbackend/onnx/onnx_test_scan9_sum.go @@ -11,6 +11,268 @@ func init() { testbackend.Register("Scan", "TestScan9Sum", NewTestScan9Sum) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"initial", "x"}, + Output: {"y", "z"}, + Name: "", + OpType: "Scan", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "body", + RefAttrName: "", + DocString: "", + Type: 5, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"sum_in", "next"}, + Output: {"sum_out"}, + Name: "", + OpType: "Add", + Domain: "", + Attribute: nil, + DocString: "", + }, + &ir.NodeProto{ + Input: {"sum_out"}, + Output: {"scan_out"}, + Name: "", + OpType: "Identity", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "scan_body", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "sum_in", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &!%v(DEPTH EXCEEDED), + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "next", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &!%v(DEPTH EXCEEDED), + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "sum_out", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &!%v(DEPTH EXCEEDED), + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "scan_out", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &!%v(DEPTH EXCEEDED), + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "num_scan_inputs", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_scan9_sum", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "initial", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestScan9Sum version: 3. func NewTestScan9Sum() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +288,8 @@ func NewTestScan9Sum() *testbackend.TestCase { Name: "", OpType: "Scan", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000359500)(name:"body" type:GRAPH g: node: name:"scan_body" input: > > > > input: > > > > output: > > > > output: > > > > > ), - (*ir.AttributeProto)(0xc000359600)(name:"num_scan_inputs" type:INT i:1 ) + (*ir.AttributeProto)(0xc0002ca800)(name:"body" type:GRAPH g: node: name:"scan_body" input: > > > > input: > > > > output: > > > > output: > > > > > ), + (*ir.AttributeProto)(0xc0002ca900)(name:"num_scan_inputs" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_scatter_elements_with_axis.go b/backend/testbackend/onnx/onnx_test_scatter_elements_with_axis.go new file mode 100644 index 00000000..fcfec174 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_scatter_elements_with_axis.go @@ -0,0 +1,215 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ScatterElements", "TestScatterElementsWithAxis", NewTestScatterElementsWithAxis) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "indices", "updates"}, + Output: {"y"}, + Name: "", + OpType: "ScatterElements", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_scatter_elements_with_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "updates", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestScatterElementsWithAxis version: 5. +func NewTestScatterElementsWithAxis() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ScatterElements", + Title: "TestScatterElementsWithAxis", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xbf, 0x1, 0xa, 0x39, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0xa, 0x7, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0xf, 0x53, 0x63, 0x61, 0x74, 0x74, 0x65, 0x72, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x63, 0x61, 0x74, 0x74, 0x65, 0x72, 0x5f, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x5, 0x5a, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x19, 0xa, 0x7, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data", "indices", "updates"}, + Output: []string{"y"}, + Name: "", + OpType: "ScatterElements", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0002caf00)(name:"axis" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 5), + tensor.WithBacking([]float32{1, 2, 3, 4, 5}), + ), + + tensor.New( + tensor.WithShape(1, 2), + tensor.WithBacking([]int64{1, 3}), + ), + + tensor.New( + tensor.WithShape(1, 2), + tensor.WithBacking([]float32{1.1, 2.1}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 5), + tensor.WithBacking([]float32{1, 1.1, 3, 2.1, 5}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_scatter_elements_with_axis_test.go b/backend/testbackend/onnx/onnx_test_scatter_elements_with_axis_test.go new file mode 100644 index 00000000..7b6b04c8 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_scatter_elements_with_axis_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestScatterElementsWithAxis(t *testing.T) { + mytest := NewTestScatterElementsWithAxis() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_scatter_elements_with_negative_indices.go b/backend/testbackend/onnx/onnx_test_scatter_elements_with_negative_indices.go new file mode 100644 index 00000000..4a27cc56 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_scatter_elements_with_negative_indices.go @@ -0,0 +1,215 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ScatterElements", "TestScatterElementsWithNegativeIndices", NewTestScatterElementsWithNegativeIndices) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "indices", "updates"}, + Output: {"y"}, + Name: "", + OpType: "ScatterElements", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_scatter_elements_with_negative_indices", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "updates", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestScatterElementsWithNegativeIndices version: 6. +func NewTestScatterElementsWithNegativeIndices() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ScatterElements", + Title: "TestScatterElementsWithNegativeIndices", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xcb, 0x1, 0xa, 0x39, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0xa, 0x7, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0xf, 0x53, 0x63, 0x61, 0x74, 0x74, 0x65, 0x72, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x2b, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x63, 0x61, 0x74, 0x74, 0x65, 0x72, 0x5f, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x5, 0x5a, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x19, 0xa, 0x7, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data", "indices", "updates"}, + Output: []string{"y"}, + Name: "", + OpType: "ScatterElements", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0002ca200)(name:"axis" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 5), + tensor.WithBacking([]float32{1, 2, 3, 4, 5}), + ), + + tensor.New( + tensor.WithShape(1, 2), + tensor.WithBacking([]int64{1, -3}), + ), + + tensor.New( + tensor.WithShape(1, 2), + tensor.WithBacking([]float32{1.1, 2.1}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 5), + tensor.WithBacking([]float32{1, 1.1, 2.1, 4, 5}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_scatter_elements_with_negative_indices_test.go b/backend/testbackend/onnx/onnx_test_scatter_elements_with_negative_indices_test.go new file mode 100644 index 00000000..6d8425ff --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_scatter_elements_with_negative_indices_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestScatterElementsWithNegativeIndices(t *testing.T) { + mytest := NewTestScatterElementsWithNegativeIndices() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_scatter_elements_without_axis.go b/backend/testbackend/onnx/onnx_test_scatter_elements_without_axis.go new file mode 100644 index 00000000..48650d18 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_scatter_elements_without_axis.go @@ -0,0 +1,194 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ScatterElements", "TestScatterElementsWithoutAxis", NewTestScatterElementsWithoutAxis) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "indices", "updates"}, + Output: {"y"}, + Name: "", + OpType: "ScatterElements", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_scatter_elements_without_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "updates", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestScatterElementsWithoutAxis version: 5. +func NewTestScatterElementsWithoutAxis() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ScatterElements", + Title: "TestScatterElementsWithoutAxis", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xb5, 0x1, 0xa, 0x2c, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0xa, 0x7, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0xf, 0x53, 0x63, 0x61, 0x74, 0x74, 0x65, 0x72, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x22, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x63, 0x61, 0x74, 0x74, 0x65, 0x72, 0x5f, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x19, 0xa, 0x7, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data", "indices", "updates"}, + Output: []string{"y"}, + Name: "", + OpType: "ScatterElements", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 3), + tensor.WithBacking([]float32{0, 0, 0, 0, 0, 0, 0, 0, 0}), + ), + + tensor.New( + tensor.WithShape(2, 3), + tensor.WithBacking([]int64{1, 0, 2, 0, 2, 1}), + ), + + tensor.New( + tensor.WithShape(2, 3), + tensor.WithBacking([]float32{1, 1.1, 1.2, 2, 2.1, 2.2}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 3), + tensor.WithBacking([]float32{2, 1.1, 0, 1, 0, 2.2, 0, 2.1, 1.2}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_scatter_elements_without_axis_test.go b/backend/testbackend/onnx/onnx_test_scatter_elements_without_axis_test.go new file mode 100644 index 00000000..ca249d3c --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_scatter_elements_without_axis_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestScatterElementsWithoutAxis(t *testing.T) { + mytest := NewTestScatterElementsWithoutAxis() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_scatter_with_axis.go b/backend/testbackend/onnx/onnx_test_scatter_with_axis.go index 27da8cdc..6a146503 100644 --- a/backend/testbackend/onnx/onnx_test_scatter_with_axis.go +++ b/backend/testbackend/onnx/onnx_test_scatter_with_axis.go @@ -11,12 +11,165 @@ func init() { testbackend.Register("Scatter", "TestScatterWithAxis", NewTestScatterWithAxis) } -// NewTestScatterWithAxis version: 3. +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "indices", "updates"}, + Output: {"y"}, + Name: "", + OpType: "Scatter", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_scatter_with_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "updates", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestScatterWithAxis version: 5. func NewTestScatterWithAxis() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "Scatter", Title: "TestScatterWithAxis", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xae, 0x1, 0xa, 0x31, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0xa, 0x7, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0x7, 0x53, 0x63, 0x61, 0x74, 0x74, 0x65, 0x72, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x16, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x63, 0x61, 0x74, 0x74, 0x65, 0x72, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x5, 0x5a, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x19, 0xa, 0x7, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xae, 0x1, 0xa, 0x31, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0xa, 0x7, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0x7, 0x53, 0x63, 0x61, 0x74, 0x74, 0x65, 0x72, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x16, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x63, 0x61, 0x74, 0x74, 0x65, 0x72, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x5, 0x5a, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x5a, 0x19, 0xa, 0x7, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x2, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x5, 0x42, 0x4, 0xa, 0x0, 0x10, 0xa}, /* @@ -26,7 +179,7 @@ func NewTestScatterWithAxis() *testbackend.TestCase { Name: "", OpType: "Scatter", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126500)(name:"axis" type:INT i:1 ) + (*ir.AttributeProto)(0xc0002ca900)(name:"axis" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_scatter_without_axis.go b/backend/testbackend/onnx/onnx_test_scatter_without_axis.go index 28ed8796..7edfec9a 100644 --- a/backend/testbackend/onnx/onnx_test_scatter_without_axis.go +++ b/backend/testbackend/onnx/onnx_test_scatter_without_axis.go @@ -11,12 +11,146 @@ func init() { testbackend.Register("Scatter", "TestScatterWithoutAxis", NewTestScatterWithoutAxis) } -// NewTestScatterWithoutAxis version: 3. +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "indices", "updates"}, + Output: {"y"}, + Name: "", + OpType: "Scatter", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_scatter_without_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "updates", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestScatterWithoutAxis version: 5. func NewTestScatterWithoutAxis() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "Scatter", Title: "TestScatterWithoutAxis", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xa4, 0x1, 0xa, 0x24, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0xa, 0x7, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0x7, 0x53, 0x63, 0x61, 0x74, 0x74, 0x65, 0x72, 0x12, 0x19, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x63, 0x61, 0x74, 0x74, 0x65, 0x72, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x19, 0xa, 0x7, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0x9}, + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xa4, 0x1, 0xa, 0x24, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0xa, 0x7, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0x7, 0x53, 0x63, 0x61, 0x74, 0x74, 0x65, 0x72, 0x12, 0x19, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x63, 0x61, 0x74, 0x74, 0x65, 0x72, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x16, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x19, 0xa, 0x7, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x62, 0x13, 0xa, 0x1, 0x79, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x42, 0x4, 0xa, 0x0, 0x10, 0xa}, /* diff --git a/backend/testbackend/onnx/onnx_test_scatternd.go b/backend/testbackend/onnx/onnx_test_scatternd.go new file mode 100644 index 00000000..a2cadeb9 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_scatternd.go @@ -0,0 +1,206 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("ScatterND", "TestScatternd", NewTestScatternd) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data", "indices", "updates"}, + Output: {"y"}, + Name: "", + OpType: "ScatterND", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_scatternd", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "updates", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestScatternd version: 5. +func NewTestScatternd() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "ScatterND", + Title: "TestScatternd", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xa7, 0x1, 0xa, 0x26, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0xa, 0x7, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0x9, 0x53, 0x63, 0x61, 0x74, 0x74, 0x65, 0x72, 0x4e, 0x44, 0x12, 0xe, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x63, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x64, 0x5a, 0x1a, 0xa, 0x4, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x4, 0x5a, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x1, 0x5a, 0x1d, 0xa, 0x7, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x4, 0x62, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"data", "indices", "updates"}, + Output: []string{"y"}, + Name: "", + OpType: "ScatterND", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(4, 4, 4), + tensor.WithBacking([]float32{1, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8}), + ), + + tensor.New( + tensor.WithShape(2, 1), + tensor.WithBacking([]int64{0, 2}), + ), + + tensor.New( + tensor.WithShape(2, 4, 4), + tensor.WithBacking([]float32{5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(4, 4, 4), + tensor.WithBacking([]float32{5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 1, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_scatternd_test.go b/backend/testbackend/onnx/onnx_test_scatternd_test.go new file mode 100644 index 00000000..d1d643e3 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_scatternd_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestScatternd(t *testing.T) { + mytest := NewTestScatternd() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_selu.go b/backend/testbackend/onnx/onnx_test_selu.go index 78908913..c339ef32 100644 --- a/backend/testbackend/onnx/onnx_test_selu.go +++ b/backend/testbackend/onnx/onnx_test_selu.go @@ -11,6 +11,137 @@ func init() { testbackend.Register("Selu", "TestSelu", NewTestSelu) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Selu", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "alpha", + RefAttrName: "", + DocString: "", + Type: 1, + F: 2, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "gamma", + RefAttrName: "", + DocString: "", + Type: 1, + F: 3, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_selu", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSelu version: 3. func NewTestSelu() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +157,8 @@ func NewTestSelu() *testbackend.TestCase { Name: "", OpType: "Selu", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000118700)(name:"alpha" type:FLOAT f:2 ), - (*ir.AttributeProto)(0xc000118800)(name:"gamma" type:FLOAT f:3 ) + (*ir.AttributeProto)(0xc0002cb600)(name:"alpha" type:FLOAT f:2 ), + (*ir.AttributeProto)(0xc0002cb700)(name:"gamma" type:FLOAT f:3 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_selu_default.go b/backend/testbackend/onnx/onnx_test_selu_default.go index d5c5d45f..443ad765 100644 --- a/backend/testbackend/onnx/onnx_test_selu_default.go +++ b/backend/testbackend/onnx/onnx_test_selu_default.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Selu", "TestSeluDefault", NewTestSeluDefault) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Selu", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_selu_default", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSeluDefault version: 3. func NewTestSeluDefault() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_selu_example.go b/backend/testbackend/onnx/onnx_test_selu_example.go index 2bd3c030..d10fea44 100644 --- a/backend/testbackend/onnx/onnx_test_selu_example.go +++ b/backend/testbackend/onnx/onnx_test_selu_example.go @@ -11,6 +11,121 @@ func init() { testbackend.Register("Selu", "TestSeluExample", NewTestSeluExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Selu", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "alpha", + RefAttrName: "", + DocString: "", + Type: 1, + F: 2, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "gamma", + RefAttrName: "", + DocString: "", + Type: 1, + F: 3, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_selu_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSeluExample version: 3. func NewTestSeluExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +141,8 @@ func NewTestSeluExample() *testbackend.TestCase { Name: "", OpType: "Selu", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000118e00)(name:"alpha" type:FLOAT f:2 ), - (*ir.AttributeProto)(0xc000118f00)(name:"gamma" type:FLOAT f:3 ) + (*ir.AttributeProto)(0xc0002ca700)(name:"alpha" type:FLOAT f:2 ), + (*ir.AttributeProto)(0xc0002ca800)(name:"gamma" type:FLOAT f:3 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_shape.go b/backend/testbackend/onnx/onnx_test_shape.go index f7d1059e..79700b75 100644 --- a/backend/testbackend/onnx/onnx_test_shape.go +++ b/backend/testbackend/onnx/onnx_test_shape.go @@ -11,6 +11,92 @@ func init() { testbackend.Register("Shape", "TestShape", NewTestShape) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Shape", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_shape", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestShape version: 3. func NewTestShape() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_shape_example.go b/backend/testbackend/onnx/onnx_test_shape_example.go index 79132d3f..33277db4 100644 --- a/backend/testbackend/onnx/onnx_test_shape_example.go +++ b/backend/testbackend/onnx/onnx_test_shape_example.go @@ -11,6 +11,88 @@ func init() { testbackend.Register("Shape", "TestShapeExample", NewTestShapeExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Shape", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_shape_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestShapeExample version: 3. func NewTestShapeExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_shrink_hard.go b/backend/testbackend/onnx/onnx_test_shrink_hard.go index dc93bc46..5b69b480 100644 --- a/backend/testbackend/onnx/onnx_test_shrink_hard.go +++ b/backend/testbackend/onnx/onnx_test_shrink_hard.go @@ -11,6 +11,103 @@ func init() { testbackend.Register("Shrink", "TestShrinkHard", NewTestShrinkHard) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Shrink", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "lambd", + RefAttrName: "", + DocString: "", + Type: 1, + F: 1.5, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_shrink_hard", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestShrinkHard version: 4. func NewTestShrinkHard() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +123,7 @@ func NewTestShrinkHard() *testbackend.TestCase { Name: "", OpType: "Shrink", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000127c00)(name:"lambd" type:FLOAT f:1.5 ) + (*ir.AttributeProto)(0xc0002cae00)(name:"lambd" type:FLOAT f:1.5 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_shrink_soft.go b/backend/testbackend/onnx/onnx_test_shrink_soft.go index a889ce33..d82a0501 100644 --- a/backend/testbackend/onnx/onnx_test_shrink_soft.go +++ b/backend/testbackend/onnx/onnx_test_shrink_soft.go @@ -11,6 +11,121 @@ func init() { testbackend.Register("Shrink", "TestShrinkSoft", NewTestShrinkSoft) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Shrink", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "bias", + RefAttrName: "", + DocString: "", + Type: 1, + F: 1.5, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "lambd", + RefAttrName: "", + DocString: "", + Type: 1, + F: 1.5, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_shrink_soft", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestShrinkSoft version: 4. func NewTestShrinkSoft() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +141,8 @@ func NewTestShrinkSoft() *testbackend.TestCase { Name: "", OpType: "Shrink", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000132300)(name:"bias" type:FLOAT f:1.5 ), - (*ir.AttributeProto)(0xc000132400)(name:"lambd" type:FLOAT f:1.5 ) + (*ir.AttributeProto)(0xc000216b00)(name:"bias" type:FLOAT f:1.5 ), + (*ir.AttributeProto)(0xc000216c00)(name:"lambd" type:FLOAT f:1.5 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_sigmoid.go b/backend/testbackend/onnx/onnx_test_sigmoid.go index e219eade..7401e20f 100644 --- a/backend/testbackend/onnx/onnx_test_sigmoid.go +++ b/backend/testbackend/onnx/onnx_test_sigmoid.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Sigmoid", "TestSigmoid", NewTestSigmoid) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Sigmoid", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_sigmoid", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSigmoid version: 3. func NewTestSigmoid() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_sigmoid_example.go b/backend/testbackend/onnx/onnx_test_sigmoid_example.go index 01f9172a..77b00c38 100644 --- a/backend/testbackend/onnx/onnx_test_sigmoid_example.go +++ b/backend/testbackend/onnx/onnx_test_sigmoid_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Sigmoid", "TestSigmoidExample", NewTestSigmoidExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Sigmoid", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_sigmoid_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSigmoidExample version: 3. func NewTestSigmoidExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_sign.go b/backend/testbackend/onnx/onnx_test_sign.go index 3827e7a2..b154c6be 100644 --- a/backend/testbackend/onnx/onnx_test_sign.go +++ b/backend/testbackend/onnx/onnx_test_sign.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Sign", "TestSign", NewTestSign) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Sign", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_sign", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:11}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:11}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSign version: 3. func NewTestSign() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_sin.go b/backend/testbackend/onnx/onnx_test_sin.go index 0f5d8c40..9e3fd9b8 100644 --- a/backend/testbackend/onnx/onnx_test_sin.go +++ b/backend/testbackend/onnx/onnx_test_sin.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Sin", "TestSin", NewTestSin) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Sin", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_sin", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSin version: 3. func NewTestSin() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_sin_example.go b/backend/testbackend/onnx/onnx_test_sin_example.go index d31eb5f0..13a23ad7 100644 --- a/backend/testbackend/onnx/onnx_test_sin_example.go +++ b/backend/testbackend/onnx/onnx_test_sin_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Sin", "TestSinExample", NewTestSinExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Sin", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_sin_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSinExample version: 3. func NewTestSinExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_sinh.go b/backend/testbackend/onnx/onnx_test_sinh.go index ff3065c5..e964c016 100644 --- a/backend/testbackend/onnx/onnx_test_sinh.go +++ b/backend/testbackend/onnx/onnx_test_sinh.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Sinh", "TestSinh", NewTestSinh) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Sinh", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_sinh", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSinh version: 3. func NewTestSinh() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_sinh_example.go b/backend/testbackend/onnx/onnx_test_sinh_example.go index 9aa8469d..4da32af7 100644 --- a/backend/testbackend/onnx/onnx_test_sinh_example.go +++ b/backend/testbackend/onnx/onnx_test_sinh_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Sinh", "TestSinhExample", NewTestSinhExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Sinh", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_sinh_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSinhExample version: 3. func NewTestSinhExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_size.go b/backend/testbackend/onnx/onnx_test_size.go index db163f0b..dfe5bb9a 100644 --- a/backend/testbackend/onnx/onnx_test_size.go +++ b/backend/testbackend/onnx/onnx_test_size.go @@ -11,6 +11,85 @@ func init() { testbackend.Register("Size", "TestSize", NewTestSize) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Size", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_size", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSize version: 3. func NewTestSize() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_size_example.go b/backend/testbackend/onnx/onnx_test_size_example.go index 7a5e4e00..0edefc0c 100644 --- a/backend/testbackend/onnx/onnx_test_size_example.go +++ b/backend/testbackend/onnx/onnx_test_size_example.go @@ -11,6 +11,81 @@ func init() { testbackend.Register("Size", "TestSizeExample", NewTestSizeExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Size", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_size_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{}, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSizeExample version: 3. func NewTestSizeExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_slice.go b/backend/testbackend/onnx/onnx_test_slice.go index 1715f33d..27a33f9f 100644 --- a/backend/testbackend/onnx/onnx_test_slice.go +++ b/backend/testbackend/onnx/onnx_test_slice.go @@ -11,6 +11,180 @@ func init() { testbackend.Register("Slice", "TestSlice", NewTestSlice) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "starts", "ends", "axes", "steps"}, + Output: {"y"}, + Name: "", + OpType: "Slice", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_slice", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:20}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "starts", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "ends", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "axes", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "steps", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSlice version: 4. func NewTestSlice() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_slice_default_axes.go b/backend/testbackend/onnx/onnx_test_slice_default_axes.go index 5ed6962d..7115dceb 100644 --- a/backend/testbackend/onnx/onnx_test_slice_default_axes.go +++ b/backend/testbackend/onnx/onnx_test_slice_default_axes.go @@ -11,6 +11,140 @@ func init() { testbackend.Register("Slice", "TestSliceDefaultAxes", NewTestSliceDefaultAxes) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "starts", "ends"}, + Output: {"y"}, + Name: "", + OpType: "Slice", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_slice_default_axes", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:20}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "starts", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "ends", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:20}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSliceDefaultAxes version: 4. func NewTestSliceDefaultAxes() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_slice_default_steps.go b/backend/testbackend/onnx/onnx_test_slice_default_steps.go index 42f0f838..d1f811b6 100644 --- a/backend/testbackend/onnx/onnx_test_slice_default_steps.go +++ b/backend/testbackend/onnx/onnx_test_slice_default_steps.go @@ -11,6 +11,160 @@ func init() { testbackend.Register("Slice", "TestSliceDefaultSteps", NewTestSliceDefaultSteps) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "starts", "ends", "axes"}, + Output: {"y"}, + Name: "", + OpType: "Slice", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_slice_default_steps", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:20}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "starts", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "ends", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "axes", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:20}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSliceDefaultSteps version: 4. func NewTestSliceDefaultSteps() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_slice_end_out_of_bounds.go b/backend/testbackend/onnx/onnx_test_slice_end_out_of_bounds.go index 3e60d3ed..91213196 100644 --- a/backend/testbackend/onnx/onnx_test_slice_end_out_of_bounds.go +++ b/backend/testbackend/onnx/onnx_test_slice_end_out_of_bounds.go @@ -11,6 +11,180 @@ func init() { testbackend.Register("Slice", "TestSliceEndOutOfBounds", NewTestSliceEndOutOfBounds) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "starts", "ends", "axes", "steps"}, + Output: {"y"}, + Name: "", + OpType: "Slice", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_slice_end_out_of_bounds", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:20}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "starts", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "ends", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "axes", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "steps", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:20}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:9}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSliceEndOutOfBounds version: 4. func NewTestSliceEndOutOfBounds() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_slice_neg.go b/backend/testbackend/onnx/onnx_test_slice_neg.go index 4dc532f8..c6650645 100644 --- a/backend/testbackend/onnx/onnx_test_slice_neg.go +++ b/backend/testbackend/onnx/onnx_test_slice_neg.go @@ -11,6 +11,180 @@ func init() { testbackend.Register("Slice", "TestSliceNeg", NewTestSliceNeg) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "starts", "ends", "axes", "steps"}, + Output: {"y"}, + Name: "", + OpType: "Slice", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_slice_neg", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:20}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "starts", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "ends", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "axes", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "steps", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:20}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:9}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSliceNeg version: 4. func NewTestSliceNeg() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_slice_neg_steps.go b/backend/testbackend/onnx/onnx_test_slice_neg_steps.go index 70304afb..ac3d4853 100644 --- a/backend/testbackend/onnx/onnx_test_slice_neg_steps.go +++ b/backend/testbackend/onnx/onnx_test_slice_neg_steps.go @@ -11,6 +11,180 @@ func init() { testbackend.Register("Slice", "TestSliceNegSteps", NewTestSliceNegSteps) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "starts", "ends", "axes", "steps"}, + Output: {"y"}, + Name: "", + OpType: "Slice", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_slice_neg_steps", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:20}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "starts", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "ends", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "axes", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "steps", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:19}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSliceNegSteps version: 4. func NewTestSliceNegSteps() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_slice_negative_axes.go b/backend/testbackend/onnx/onnx_test_slice_negative_axes.go new file mode 100644 index 00000000..b3c8aa41 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_slice_negative_axes.go @@ -0,0 +1,219 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Slice", "TestSliceNegativeAxes", NewTestSliceNegativeAxes) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "starts", "ends", "axes"}, + Output: {"y"}, + Name: "", + OpType: "Slice", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_slice_negative_axes", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:20}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "starts", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "ends", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "axes", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:20}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestSliceNegativeAxes version: 6. +func NewTestSliceNegativeAxes() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Slice", + Title: "TestSliceNegativeAxes", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xad, 0x1, 0xa, 0x21, 0xa, 0x1, 0x78, 0xa, 0x6, 0x73, 0x74, 0x61, 0x72, 0x74, 0x73, 0xa, 0x4, 0x65, 0x6e, 0x64, 0x73, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x12, 0x1, 0x79, 0x22, 0x5, 0x53, 0x6c, 0x69, 0x63, 0x65, 0x12, 0x18, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x14, 0xa, 0x2, 0x8, 0xa, 0xa, 0x2, 0x8, 0x5, 0x5a, 0x14, 0xa, 0x6, 0x73, 0x74, 0x61, 0x72, 0x74, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x12, 0xa, 0x4, 0x65, 0x6e, 0x64, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x5a, 0x12, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x14, 0xa, 0x2, 0x8, 0xa, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x", "starts", "ends", "axes"}, + Output: []string{"y"}, + Name: "", + OpType: "Slice", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(20, 10, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117, -0.67246044, -0.35955316, -0.8131463, -1.7262826, 0.17742614, -0.40178093, -1.6301984, 0.46278226, -0.9072984, 0.051945396, 0.7290906, 0.12898292, 1.1394007, -1.2348258, 0.40234163, -0.6848101, -0.87079716, -0.5788497, -0.31155252, 0.05616534, -1.1651498, 0.9008265, 0.46566245, -1.5362437, 1.4882522, 1.8958892, 1.1787796, -0.17992483, -1.0707526, 1.0544517, -0.40317693, 1.222445, 0.20827498, 0.97663903, 0.3563664, 0.7065732, 0.01050002, 1.7858706, 0.12691209, 0.40198937, 1.8831507, -1.347759, -1.270485, 0.9693967, -1.1731234, 1.9436212, -0.41361898, -0.7474548, 1.922942, 1.4805148, 1.867559, 0.90604466, -0.86122566, 1.9100649, -0.26800337, 0.8024564, 0.947252, -0.15501009, 0.61407936, 0.9222067, 0.37642553, -1.0994008, 0.2982382, 1.3263859, -0.69456786, -0.14963454, -0.43515354, 1.8492638, 0.67229474, 0.40746182, -0.76991606, 0.5392492, -0.6743327, 0.031830557, -0.6358461, 0.67643327, 0.57659084, -0.20829876, 0.3960067, -1.0930616, -1.4912575, 0.4393917, 0.1666735, 0.63503146, 2.3831449, 0.94447947, -0.91282225, 1.1170163, -1.3159074, -0.4615846, -0.0682416, 1.7133427, -0.74475485, -0.82643855, -0.09845252, -0.6634783, 1.1266359, -1.0799315, -1.1474687, -0.43782005, -0.49803245, 1.929532, 0.9494208, 0.08755124, -1.2254355, 0.844363, -1.0002153, -1.5447711, 1.1880298, 0.3169426, 0.9208588, 0.31872764, 0.8568306, -0.6510256, -1.0342429, 0.6815945, -0.80340964, -0.6895498, -0.4555325, 0.017479159, -0.35399392, -1.3749512, -0.6436184, -2.2234032, 0.62523144, -1.6020577, -1.1043833, 0.05216508, -0.739563, 1.5430146, -1.2928569, 0.26705086, -0.039282817, -1.1680934, 0.5232767, -0.17154633, 0.77179056, 0.82350415, 2.163236, 1.336528, -0.36918184, -0.23937918, 1.0996596, 0.6552637, 0.64013153, -1.616956, -0.024326125, -0.7380309, 0.2799246, -0.09815039, 0.9101789, 0.3172182, 0.78632796, -0.4664191, -0.94444627, -0.4100497, -0.017020414, 0.37915173, 2.259309, -0.042257152, -0.955945, -0.34598178, -0.463596, 0.48148146, -1.540797, 0.06326199, 0.15650654, 0.23218104, -0.5973161, -0.23792173, -1.424061, -0.49331987, -0.54286146, 0.41605005, -1.1561824, 0.7811981, 1.4944845, -2.069985, 0.42625874, 0.676908, -0.63743705, -0.3972718, -0.13288058, -0.29779088, -0.30901298, -1.6760038, 1.1523316, 1.0796186, -0.81336427, -1.4664243, 0.5210649, -0.57578796, 0.14195317, -0.31932843, 0.69153875, 0.6947491, -0.7255974, -1.383364, -1.5829384, 0.6103794, -1.1888592, -0.5068163, -0.596314, -0.052567296, -1.9362798, 0.1887786, 0.52389103, 0.08842209, -0.31088617, 0.097400166, 0.39904633, -2.7725928, 1.9559124, 0.39009333, -0.6524086, -0.39095336, 0.49374178, -0.11610394, -2.0306845, 2.064493, -0.11054066, 1.0201727, -0.69204986, 1.5363771, 0.2863437, 0.60884386, -1.0452534, 1.2111453, 0.68981814, 1.3018463, -0.6280876, -0.48102713, 2.3039167, -1.0600158, -0.1359497, 1.1368914, 0.09772497, 0.5829537, -0.39944902, 0.37005588, -1.3065269, 1.6581306, -0.11816405, -0.6801782, 0.6663831, -0.4607198, -1.3342584, -1.3467175, 0.69377315, -0.15957344, -0.13370156, 1.0777438, -1.1268258, -0.7306777, -0.3848798, 0.09435159, -0.042171452, -0.2868872, -0.0616264, -0.10730527, -0.7196044, -0.812993, 0.27451634, -0.8909151, -1.1573553, -0.31229225, -0.15766701, 2.2567234, -0.7047003, 0.9432607, 0.7471883, -1.1889449, 0.77325296, -1.1838807, -2.6591723, 0.60631955, -1.7558906, 0.45093447, -0.6840109, 1.6595508, 1.0685093, -0.4533858, -0.6878376, -1.2140774, -0.44092262, -0.28035548, -0.36469355, 0.15670386, 0.5785215, 0.34965447, -0.76414394, -1.4377915, 1.3645319, -0.6894492, -0.6522936, -0.52118933, -1.8430696, -0.477974, -0.4796558, 0.6203583, 0.6984571, 0.003770889, 0.93184835, 0.339965, -0.015682112, 0.16092817, -0.19065349, -0.3948495, -0.26773354, -1.1280113, 0.2804417, -0.9931236, 0.8416313, -0.24945858, 0.04949498, 0.4938368, 0.6433145, -1.5706234, -0.20690368, 0.8801789, -1.6981058, 0.38728046, -2.2555642, -1.0225068, 0.038630553, -1.6567152, -0.98551077, -1.471835, 1.648135, 0.16422775, 0.5672903, -0.2226751, -0.35343176, -1.6164742, -0.29183736, -0.7614922, 0.8579239, 1.1411018, 1.4665787, 0.85255194, -0.5986539, -1.1158969, 0.7666632, 0.3562928, -1.7685385, 0.3554818, 0.8145198, 0.058925588, -0.18505368, -0.8076485, -1.4465348, 0.800298, -0.30911446, -0.23346666, 1.7327212, 0.6845011, 0.370825, 0.1420618, 1.5199949, 1.7195894, 0.9295051, 0.5822246, -2.094603, 0.12372191, -0.13010696, 0.09395323, 0.9430461, -2.7396772, -0.56931204, 0.26990435, -0.46684554, -1.4169061, 0.8689635, 0.27687192, -0.97110456, 0.3148172, 0.8215857, 0.005292646, 0.8005648, 0.078260176, -0.39522898, -1.1594205, -0.085930765, 0.19429293, 0.87583274, -0.11510747, 0.4574156, -0.964612, -0.78262913, -0.1103893, -1.0546285, 0.8202478, 0.46313033, 0.27909577, 0.3389041, 2.0210435, -0.4688642, -2.2014413, 0.1993002, -0.050603542, -0.51751906, -0.97882986, -0.43918952, 0.18133843, -0.5028167, 2.4124537, -0.96050435, -0.79311734, -2.28862, 0.25148442, -2.0164065, -0.53945464, -0.27567053, -0.70972794, 1.7388726, 0.99439436, 1.3191369, -0.8824188, 1.128594, 0.49600095, 0.77140594, 1.0294389, -0.90876323, -0.42431763, 0.86259604, -2.6556191, 1.5133281, 0.55313206, -0.045703962, 0.22050765, -1.0299352, -0.34994337, 1.1002843, 1.298022, 2.696224, -0.07392467, -0.65855294, -0.51423395, -1.0180418, -0.07785475, 0.38273242, -0.03424228, 1.0963469, -0.2342158, -0.34745064, -0.5812685, -1.6326345, -1.5677677, -1.179158, 1.3014281, 0.8952603, 1.3749641, -1.3322116, -1.9686247, -0.6600563, 0.17581895, 0.49869028, 1.0479722, 0.28427967, 1.7426687, -0.22260568, -0.9130792, -1.6812183, -0.8889713, 0.24211796, -0.8887203, 0.9367425, 1.4123276, -2.369587, 0.8640523, -2.239604, 0.40149906, 1.2248706, 0.064856105, -1.2796892, -0.5854312, -0.26164544, -0.18224478, -0.20289683, -0.10988278, 0.21348006, -1.2085737, -0.24201983, 1.5182612, -0.38464543, -0.4438361, 1.0781974, -2.5591846, 1.1813786, -0.63190377, 0.16392857, 0.09632136, 0.9424681, -0.26759475, -0.6780258, 1.2978458, -2.364174, 0.020334182, -1.3479254, -0.7615734, 2.0112567, -0.044595428, 0.1950697, -1.7815628, -0.7290447, 0.1965574, 0.3547577, 0.61688656, 0.008627899, 0.5270042, 0.4537819, -1.8297404, 0.037005723, 0.76790243, 0.5898798, -0.36385882, -0.8056265, -1.1183119, -0.13105401, 1.1330799, -1.9518042, -0.6598917, -1.1398025, 0.7849575, -0.5543096, -0.47063765, -0.21694957, 0.44539326, -0.392389, -3.046143, 0.5433119, 0.43904296, -0.21954103, -1.0840366, 0.35178012, 0.37923554, -0.47003287, -0.21673147, -0.9301565, -0.17858909, -1.5504293, 0.41731882, -0.9443685, 0.23810315, -1.405963, -0.5900577, -0.110489406, -1.6606998, 0.115147874, -0.37914756, -1.7423562, -1.3032428, 0.60512006, 0.895556, -0.13190864, 0.40476182, 0.22384356, 0.32962298, 1.285984, -1.5069984, 0.67646074, -0.38200897, -0.22425893, -0.30224973, -0.3751471, -1.2261962, 0.1833392, 1.670943, -0.05613302, -0.0013850428, -0.687299, -0.11747455, 0.46616644, -0.37024245, -0.45380405, 0.40326455, -0.91800475, 0.25249663, 0.8203218, 1.3599485, -0.09038201, 1.3675972, 1.0344099, -0.99621266, -1.2179385, -0.30496365, 1.0289356, -0.07228701, -0.6006576, 1.5522432, 0.28690448, -2.3205943, 0.31716064, 0.52004063, 0.22560866, 0.4497121, -0.067275606, -1.3183959, -0.370704, -0.94561577, -0.9327409, -1.2630683, 0.45248908, 0.097896144, -0.44816536, -0.64933795, -0.023423105, 1.0791948, -2.0042157, 0.37687653, -0.545712, -1.8845859, -1.945703, -0.9127835, 0.21950956, 0.39306292, -0.9389816, 1.017021, 1.4229835, 0.39608657, -0.59140265, 1.1244192, 0.7553957, 0.86740744, -0.6564637, -2.8345544, 2.116791, -1.6108783, -0.035768073, 2.3807454, 0.33057675, 0.94924647, -1.5023966, -1.7776669, -0.5327028, 1.0907497, -0.34624946, -0.7946363, 0.19796729, 1.0819352, -1.4449402, -1.210543, -0.7886692, 1.0946383, 0.23482153, 2.1321535, 0.9364457, -0.035095178, 1.2650778, 0.21149701, -0.70492136, 0.67997485, -0.6963267, -0.2903971, 1.3277828, -0.10128149, -0.8031414, -0.46433768, 1.0217906, -0.55254066, -0.38687086, -0.51029277, 0.1839255, -0.38548976, -1.6018361, -0.8871809, -0.932789, 1.2433194, 0.81267405, 0.58725935, -0.50535834, -0.81579155, -0.5075176, -1.0518801, 2.4972005, -2.2453218, 0.56400853, -1.2845523, -0.10434349, -0.98800194, -1.177629, -1.1401963, 1.7549862, -0.13298842, -0.7657022, 0.55578697, 0.010349315, 0.72003376, -1.8242567, 0.30360392, 0.7726948, -1.6615983, 0.44819528, 1.6961815, -0.014857704, 0.82140595, 0.67057043, -0.7075057, 0.039766736, -1.5669947, -0.45130304, 0.26568797, 0.7231005, 0.024612125, 0.71998376, -1.1029062, -0.10169727, 0.019279385, 1.8495913, -0.21416666, -0.49901664, 0.021351224, -0.91911346, 0.19275385, -0.3650552, -1.7913276, -0.058586553, -0.3175431, -1.6324233, -0.06713416, 1.4893559, 0.5213038, 0.6119272, -1.3414967, 0.47689837, 0.14844958, 0.5290452, 0.4226286, -1.3597807, -0.041400813, -0.75787085, -0.050084095, -0.8974009, 1.3124703, -0.8589724, -0.8989422, 0.07458641, -1.0770991, -0.4246633, -0.8299646, 1.411172, 0.78580385, -0.057469517, -0.39121705, 0.9409176, 0.4052041, 0.49805242, -0.026192237, -1.68823, -0.112465985, -0.5324899, 0.6450553, 1.0118425, -0.65795106, 0.46838522, 1.735879, -0.66771275, 1.6819217, -0.85258585, 0.022959756, -0.011145612, 0.0114989, -0.837678, -0.5911831, -0.66772026, 0.3269626, 0.33003512, 2.2259443, 1.370989, -0.50984323, 0.3248696, 0.997118, 0.030601824, -0.069641575, 0.05157494, 0.8672766, -0.84832054, -0.32566947, 0.47043315, 0.31144708, 0.23958276, -0.36980116, 0.9725358, 2.1338682, 0.4064155, -0.1931767, 0.7557403, -0.53913265, -0.74969035, 0.032808747, -2.5827966, -1.1539503, -0.34796184, -1.3533889, -1.0326431, -0.43674833, -1.6429653, -0.40607178, -0.53527015, 0.025405208, 1.154184, 0.17250441, 0.021062022, 0.099454455, 0.22739278, -1.0167387, -0.11477532, 0.30875126, -1.37076, 0.8656529, 1.0813761, -0.63137597, -0.24133779, -0.87819034, 0.69938046, -1.0612223, -0.222477, -0.8589199, 0.05095428, -1.7942293, 1.3264617, -0.9646064, 0.059894685, -0.21252304, -0.7621145, -0.88778013, 0.93639857, -0.5256406, 0.2711702, -0.80149686, -0.64718145, 0.47224715, 0.9304085, -0.17531641, -1.4219198, 1.997956, -0.8565493, -1.5415874, 2.5944245, -0.4040323, -1.4617327, -0.6834398, 0.3675449, 0.19031155, -0.8517292, 1.8227236, -0.5215797, -1.1846865, 0.9606934, 1.3290628, -0.8174931, -1.4013473, 1.0304383, -2.0473237, -1.2266216, 0.96744615, -0.055352546, -0.26393735, 0.3528166, -0.15277442, -1.2986867, 1.2760754, 1.325014, 0.20533256, 0.045134015, 2.339625, -0.27643284, -0.25957698, 0.36448124, 1.471322, 1.5927707, -0.25857264, 0.30833125, -1.3780835, -0.3119761, -0.84029037, -1.0068318, 1.6815767, -0.79228663, -0.5316059, 0.36584878, 1.2978252, 0.48111513, 2.759355, -0.074667975, 0.25871643, 0.27560067, 1.4350494, 0.5072389, -0.1162297, -0.9474886, 0.24444346, 1.4013448, -0.4103818, 0.5289436, 0.24614778, 0.86351967, -0.8047537, 2.346647, -1.2791611, -0.36555108, 0.9380925, 0.29673317, 0.82998616, -0.49610233, -0.074804984, 0.012231983, 1.5692596, 0.69042903, 0.7966721, -0.6579261, 0.9688826, 0.22558166, 1.3891454, 2.0140603, -0.30676576, -0.40630314, -0.86404496, -0.14357951, -0.38202545, 0.3595044, -0.14456682, -0.36159927, 1.0645851, -0.9378802, 0.43310794, -0.40594172, 0.7243685, 1.3852615, -0.30309826, 0.44103292, 0.17879286, -0.7994224, 0.2407875, 0.2891205, 0.41287082, -0.1983989, 0.0941923, -1.1476109, -0.35811406}), + ), + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]int64{0, 0, 3}), + ), + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]int64{20, 10, 4}), + ), + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]int64{0, -2, -1}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(20, 10, 1), + tensor.WithBacking([]float32{2.2408931, -0.10321885, 0.121675014, 0.3130677, -0.742165, 1.5327792, -1.9807965, -0.3873268, 1.9507754, -1.6138978, -1.1806322, -0.6343221, -1.7262826, -0.9072984, -1.2348258, -0.31155252, -1.5362437, -1.0707526, 0.97663903, 0.12691209, 0.9693967, 1.922942, 1.9100649, 0.61407936, 1.3263859, 0.67229474, 0.031830557, 0.3960067, 0.63503146, -1.3159074, -0.82643855, -1.1474687, 0.08755124, 1.1880298, -0.6510256, -0.4555325, -2.2234032, -0.739563, -1.1680934, 2.163236, 0.6552637, 0.2799246, -0.4664191, 2.259309, 0.48148146, -0.5973161, 0.41605005, 0.42625874, -0.29779088, -0.81336427, -0.31932843, -1.5829384, -0.052567296, -0.31088617, 0.39009333, -2.0306845, 1.5363771, 0.68981814, -1.0600158, -0.39944902, -0.6801782, 0.69377315, -0.7306777, -0.0616264, -0.8909151, -0.7047003, -1.1838807, -0.6840109, -1.2140774, 0.5785215, -0.6894492, -0.4796558, 0.339965, -0.26773354, -0.24945858, -0.20690368, -1.0225068, 1.648135, -1.6164742, 1.4665787, 0.3562928, -0.18505368, -0.23346666, 1.5199949, 0.12372191, -0.56931204, 0.27687192, 0.8005648, 0.19429293, -0.78262913, 0.27909577, 0.1993002, 0.18133843, -2.28862, -0.70972794, 1.128594, -0.42431763, -0.045703962, 1.298022, -1.0180418, -0.2342158, -1.179158, -1.9686247, 0.28427967, -0.8889713, -2.369587, 0.064856105, -0.20289683, 1.5182612, 1.1813786, -0.26759475, -1.3479254, -1.7815628, 0.008627899, 0.76790243, -0.13105401, 0.7849575, -0.392389, -1.0840366, -0.9301565, 0.23810315, 0.115147874, 0.895556, 1.285984, -0.30224973, -0.05613302, -0.37024245, 0.8203218, -0.99621266, -0.6006576, 0.52004063, -0.370704, 0.097896144, -2.0042157, -0.9127835, 1.4229835, 0.86740744, -0.035768073, -1.7776669, 0.19796729, 1.0946383, 1.2650778, -0.2903971, 1.0217906, -0.38548976, 0.81267405, -1.0518801, -0.10434349, -0.13298842, -1.8242567, 1.6961815, 0.039766736, 0.024612125, 1.8495913, 0.19275385, -1.6324233, -1.3414967, -1.3597807, 1.3124703, -0.4246633, -0.39121705, -1.68823, -0.65795106, -0.85258585, -0.5911831, 1.370989, -0.069641575, 0.47043315, 2.1338682, -0.74969035, -1.3533889, -0.53527015, 0.099454455, -1.37076, -0.87819034, 0.05095428, -0.21252304, 0.2711702, -0.17531641, 2.5944245, 0.19031155, 0.9606934, -2.0473237, 0.3528166, 0.20533256, 0.36448124, -1.3780835, -0.79228663, 2.759355, 0.5072389, -0.4103818, 2.346647, 0.82998616, 0.69042903, 1.3891454, -0.14357951, 1.0645851, 1.3852615, 0.2407875, -1.1476109}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_slice_negative_axes_test.go b/backend/testbackend/onnx/onnx_test_slice_negative_axes_test.go new file mode 100644 index 00000000..e6f82e76 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_slice_negative_axes_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestSliceNegativeAxes(t *testing.T) { + mytest := NewTestSliceNegativeAxes() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_softmax_axis_0.go b/backend/testbackend/onnx/onnx_test_softmax_axis_0.go index 1934ff91..7a2c7ca3 100644 --- a/backend/testbackend/onnx/onnx_test_softmax_axis_0.go +++ b/backend/testbackend/onnx/onnx_test_softmax_axis_0.go @@ -8,9 +8,122 @@ import ( ) func init() { - testbackend.Register("Softmax", "TestSoftmaxAxis0", NewTestSoftmaxAxis0) + //testbackend.Register("Softmax", "TestSoftmaxAxis0", NewTestSoftmaxAxis0) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Softmax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_softmax_axis_0", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSoftmaxAxis0 version: 3. func NewTestSoftmaxAxis0() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestSoftmaxAxis0() *testbackend.TestCase { Name: "", OpType: "Softmax", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126000)(name:"axis" type:INT ) + (*ir.AttributeProto)(0xc0001e6700)(name:"axis" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_softmax_axis_1.go b/backend/testbackend/onnx/onnx_test_softmax_axis_1.go index a9fd07f1..bfb9a06f 100644 --- a/backend/testbackend/onnx/onnx_test_softmax_axis_1.go +++ b/backend/testbackend/onnx/onnx_test_softmax_axis_1.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("Softmax", "TestSoftmaxAxis1", NewTestSoftmaxAxis1) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Softmax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_softmax_axis_1", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSoftmaxAxis1 version: 3. func NewTestSoftmaxAxis1() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestSoftmaxAxis1() *testbackend.TestCase { Name: "", OpType: "Softmax", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126100)(name:"axis" type:INT i:1 ) + (*ir.AttributeProto)(0xc000216e00)(name:"axis" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_softmax_axis_2.go b/backend/testbackend/onnx/onnx_test_softmax_axis_2.go index a0c35ee6..ca84dc59 100644 --- a/backend/testbackend/onnx/onnx_test_softmax_axis_2.go +++ b/backend/testbackend/onnx/onnx_test_softmax_axis_2.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("Softmax", "TestSoftmaxAxis2", NewTestSoftmaxAxis2) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Softmax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_softmax_axis_2", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSoftmaxAxis2 version: 3. func NewTestSoftmaxAxis2() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestSoftmaxAxis2() *testbackend.TestCase { Name: "", OpType: "Softmax", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126800)(name:"axis" type:INT i:2 ) + (*ir.AttributeProto)(0xc000217200)(name:"axis" type:INT i:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_softmax_default_axis.go b/backend/testbackend/onnx/onnx_test_softmax_default_axis.go index 95328756..3aa35a8c 100644 --- a/backend/testbackend/onnx/onnx_test_softmax_default_axis.go +++ b/backend/testbackend/onnx/onnx_test_softmax_default_axis.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Softmax", "TestSoftmaxDefaultAxis", NewTestSoftmaxDefaultAxis) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Softmax", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_softmax_default_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSoftmaxDefaultAxis version: 3. func NewTestSoftmaxDefaultAxis() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_softmax_example.go b/backend/testbackend/onnx/onnx_test_softmax_example.go index bcaf36cf..956e9d55 100644 --- a/backend/testbackend/onnx/onnx_test_softmax_example.go +++ b/backend/testbackend/onnx/onnx_test_softmax_example.go @@ -8,9 +8,95 @@ import ( ) func init() { - testbackend.Register("Softmax", "TestSoftmaxExample", NewTestSoftmaxExample) + //testbackend.Register("Softmax", "TestSoftmaxExample", NewTestSoftmaxExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Softmax", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_softmax_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSoftmaxExample version: 3. func NewTestSoftmaxExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_softmax_large_number.go b/backend/testbackend/onnx/onnx_test_softmax_large_number.go index 3c39e416..5e8fcb72 100644 --- a/backend/testbackend/onnx/onnx_test_softmax_large_number.go +++ b/backend/testbackend/onnx/onnx_test_softmax_large_number.go @@ -11,6 +11,92 @@ func init() { testbackend.Register("Softmax", "TestSoftmaxLargeNumber", NewTestSoftmaxLargeNumber) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Softmax", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_softmax_large_number", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSoftmaxLargeNumber version: 3. func NewTestSoftmaxLargeNumber() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_softmax_negative_axis.go b/backend/testbackend/onnx/onnx_test_softmax_negative_axis.go new file mode 100644 index 00000000..8734bac6 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_softmax_negative_axis.go @@ -0,0 +1,165 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Softmax", "TestSoftmaxNegativeAxis", NewTestSoftmaxNegativeAxis) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Softmax", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_softmax_negative_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestSoftmaxNegativeAxis version: 6. +func NewTestSoftmaxNegativeAxis() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Softmax", + Title: "TestSoftmaxNegativeAxis", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x75, 0xa, 0x25, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x7, 0x53, 0x6f, 0x66, 0x74, 0x6d, 0x61, 0x78, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1a, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x6f, 0x66, 0x74, 0x6d, 0x61, 0x78, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Softmax", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000216e00)(name:"axis" type:INT i:-1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, 0.9772779, 0.95008844, 0.1513572, 0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, 0.20515826, 0.3130677, 0.85409576, 2.5529897, 0.6536186, 0.8644362, 0.742165, 2.2697546, 1.4543657, 0.045758516, 0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, 0.88778573, 1.9807965, 0.34791216, 0.15634897, 1.2302907, 1.2023798, 0.3873268, 0.30230275, 1.048553, 1.420018, 1.7062702, 1.9507754, 0.5096522, 0.4380743, 1.2527953, 0.7774904, 1.6138978, 0.21274029, 0.89546657, 0.3869025, 0.51080513, 1.1806322, 0.028182229, 0.42833188, 0.06651722, 0.3024719, 0.6343221, 0.36274117}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 5), + tensor.WithBacking([]float32{0.22564866, 0.057690013, 0.102890454, 0.36351478, 0.2502561, 0.29449275, 0.28659353, 0.12893826, 0.1228784, 0.16709709, 0.11251291, 0.41708824, 0.20852564, 0.110024095, 0.15184915, 0.12931651, 0.41267803, 0.113720864, 0.12667899, 0.21760562, 0.44418558, 0.066478014, 0.08207955, 0.07263289, 0.33462396, 0.27603087, 0.067485005, 0.07773696, 0.29854664, 0.28020057, 0.0850921, 0.10637273, 0.17707486, 0.52825713, 0.10320311, 0.10881158, 0.31847993, 0.30971378, 0.13708425, 0.12591052, 0.134613, 0.19516963, 0.25985438, 0.33183125, 0.07853177, 0.11491964, 0.25955123, 0.16136181, 0.37243277, 0.09173455, 0.24800895, 0.14914228, 0.16881499, 0.3298475, 0.10418628, 0.21081902, 0.14681678, 0.1858872, 0.259042, 0.19743498}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_softmax_negative_axis_test.go b/backend/testbackend/onnx/onnx_test_softmax_negative_axis_test.go new file mode 100644 index 00000000..6286c446 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_softmax_negative_axis_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestSoftmaxNegativeAxis(t *testing.T) { + mytest := NewTestSoftmaxNegativeAxis() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_softplus.go b/backend/testbackend/onnx/onnx_test_softplus.go index d9144316..1d09e1c5 100644 --- a/backend/testbackend/onnx/onnx_test_softplus.go +++ b/backend/testbackend/onnx/onnx_test_softplus.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Softplus", "TestSoftplus", NewTestSoftplus) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Softplus", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_softplus", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSoftplus version: 3. func NewTestSoftplus() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_softplus_example.go b/backend/testbackend/onnx/onnx_test_softplus_example.go index 6166a799..f58843d7 100644 --- a/backend/testbackend/onnx/onnx_test_softplus_example.go +++ b/backend/testbackend/onnx/onnx_test_softplus_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Softplus", "TestSoftplusExample", NewTestSoftplusExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Softplus", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_softplus_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSoftplusExample version: 3. func NewTestSoftplusExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_softsign.go b/backend/testbackend/onnx/onnx_test_softsign.go index 13e2b137..ce89b4cf 100644 --- a/backend/testbackend/onnx/onnx_test_softsign.go +++ b/backend/testbackend/onnx/onnx_test_softsign.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Softsign", "TestSoftsign", NewTestSoftsign) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Softsign", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_softsign", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSoftsign version: 3. func NewTestSoftsign() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_softsign_example.go b/backend/testbackend/onnx/onnx_test_softsign_example.go index ab92d825..635dda92 100644 --- a/backend/testbackend/onnx/onnx_test_softsign_example.go +++ b/backend/testbackend/onnx/onnx_test_softsign_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Softsign", "TestSoftsignExample", NewTestSoftsignExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Softsign", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_softsign_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSoftsignExample version: 3. func NewTestSoftsignExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_split_equal_parts_1d.go b/backend/testbackend/onnx/onnx_test_split_equal_parts_1d.go index 7ff728fc..0c5d4b79 100644 --- a/backend/testbackend/onnx/onnx_test_split_equal_parts_1d.go +++ b/backend/testbackend/onnx/onnx_test_split_equal_parts_1d.go @@ -11,6 +11,143 @@ func init() { testbackend.Register("Split", "TestSplitEqualParts1d", NewTestSplitEqualParts1d) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"input"}, + Output: {"output_1", "output_2", "output_3"}, + Name: "", + OpType: "Split", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_split_equal_parts_1d", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "input", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output_1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "output_2", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "output_3", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSplitEqualParts1d version: 3. func NewTestSplitEqualParts1d() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +163,7 @@ func NewTestSplitEqualParts1d() *testbackend.TestCase { Name: "", OpType: "Split", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000127700)(name:"axis" type:INT ) + (*ir.AttributeProto)(0xc000330200)(name:"axis" type:INT ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_split_equal_parts_2d.go b/backend/testbackend/onnx/onnx_test_split_equal_parts_2d.go index f1a2ee5e..11b678a5 100644 --- a/backend/testbackend/onnx/onnx_test_split_equal_parts_2d.go +++ b/backend/testbackend/onnx/onnx_test_split_equal_parts_2d.go @@ -11,6 +11,135 @@ func init() { testbackend.Register("Split", "TestSplitEqualParts2d", NewTestSplitEqualParts2d) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"input"}, + Output: {"output_1", "output_2"}, + Name: "", + OpType: "Split", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_split_equal_parts_2d", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "input", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output_1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "output_2", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSplitEqualParts2d version: 3. func NewTestSplitEqualParts2d() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +155,7 @@ func NewTestSplitEqualParts2d() *testbackend.TestCase { Name: "", OpType: "Split", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000118300)(name:"axis" type:INT i:1 ) + (*ir.AttributeProto)(0xc000216d00)(name:"axis" type:INT i:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_split_equal_parts_default_axis.go b/backend/testbackend/onnx/onnx_test_split_equal_parts_default_axis.go index 7e55244e..1da8e2f5 100644 --- a/backend/testbackend/onnx/onnx_test_split_equal_parts_default_axis.go +++ b/backend/testbackend/onnx/onnx_test_split_equal_parts_default_axis.go @@ -11,6 +11,124 @@ func init() { testbackend.Register("Split", "TestSplitEqualPartsDefaultAxis", NewTestSplitEqualPartsDefaultAxis) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"input"}, + Output: {"output_1", "output_2", "output_3"}, + Name: "", + OpType: "Split", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_split_equal_parts_default_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "input", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output_1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "output_2", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "output_3", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSplitEqualPartsDefaultAxis version: 3. func NewTestSplitEqualPartsDefaultAxis() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_split_variable_parts_1d.go b/backend/testbackend/onnx/onnx_test_split_variable_parts_1d.go index cd033676..96a9e6b2 100644 --- a/backend/testbackend/onnx/onnx_test_split_variable_parts_1d.go +++ b/backend/testbackend/onnx/onnx_test_split_variable_parts_1d.go @@ -11,6 +11,141 @@ func init() { testbackend.Register("Split", "TestSplitVariableParts1d", NewTestSplitVariableParts1d) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"input"}, + Output: {"output_1", "output_2"}, + Name: "", + OpType: "Split", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "split", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 4}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_split_variable_parts_1d", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "input", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output_1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "output_2", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSplitVariableParts1d version: 3. func NewTestSplitVariableParts1d() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +161,8 @@ func NewTestSplitVariableParts1d() *testbackend.TestCase { Name: "", OpType: "Split", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000118d00)(name:"axis" type:INT ), - (*ir.AttributeProto)(0xc000118e00)(name:"split" type:INTS ints:2 ints:4 ) + (*ir.AttributeProto)(0xc000217300)(name:"axis" type:INT ), + (*ir.AttributeProto)(0xc000217400)(name:"split" type:INTS ints:2 ints:4 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_split_variable_parts_2d.go b/backend/testbackend/onnx/onnx_test_split_variable_parts_2d.go index f668d1c9..c4bf8075 100644 --- a/backend/testbackend/onnx/onnx_test_split_variable_parts_2d.go +++ b/backend/testbackend/onnx/onnx_test_split_variable_parts_2d.go @@ -11,6 +11,153 @@ func init() { testbackend.Register("Split", "TestSplitVariableParts2d", NewTestSplitVariableParts2d) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"input"}, + Output: {"output_1", "output_2"}, + Name: "", + OpType: "Split", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "split", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 4}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_split_variable_parts_2d", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "input", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output_1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "output_2", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSplitVariableParts2d version: 3. func NewTestSplitVariableParts2d() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,8 +173,8 @@ func NewTestSplitVariableParts2d() *testbackend.TestCase { Name: "", OpType: "Split", Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { - (*ir.AttributeProto)(0xc000126600)(name:"axis" type:INT i:1 ), - (*ir.AttributeProto)(0xc000126700)(name:"split" type:INTS ints:2 ints:4 ) + (*ir.AttributeProto)(0xc000217f00)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc0001e6100)(name:"split" type:INTS ints:2 ints:4 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_split_variable_parts_default_axis.go b/backend/testbackend/onnx/onnx_test_split_variable_parts_default_axis.go index db12e232..67f62004 100644 --- a/backend/testbackend/onnx/onnx_test_split_variable_parts_default_axis.go +++ b/backend/testbackend/onnx/onnx_test_split_variable_parts_default_axis.go @@ -11,6 +11,123 @@ func init() { testbackend.Register("Split", "TestSplitVariablePartsDefaultAxis", NewTestSplitVariablePartsDefaultAxis) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"input"}, + Output: {"output_1", "output_2"}, + Name: "", + OpType: "Split", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "split", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 4}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_split_variable_parts_default_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "input", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "output_1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "output_2", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSplitVariablePartsDefaultAxis version: 3. func NewTestSplitVariablePartsDefaultAxis() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +143,7 @@ func NewTestSplitVariablePartsDefaultAxis() *testbackend.TestCase { Name: "", OpType: "Split", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000119500)(name:"split" type:INTS ints:2 ints:4 ) + (*ir.AttributeProto)(0xc000330000)(name:"split" type:INTS ints:2 ints:4 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_sqrt.go b/backend/testbackend/onnx/onnx_test_sqrt.go index a8d48847..56f6cbbc 100644 --- a/backend/testbackend/onnx/onnx_test_sqrt.go +++ b/backend/testbackend/onnx/onnx_test_sqrt.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Sqrt", "TestSqrt", NewTestSqrt) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Sqrt", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_sqrt", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSqrt version: 3. func NewTestSqrt() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_sqrt_example.go b/backend/testbackend/onnx/onnx_test_sqrt_example.go index 1c142a2d..69d7fb12 100644 --- a/backend/testbackend/onnx/onnx_test_sqrt_example.go +++ b/backend/testbackend/onnx/onnx_test_sqrt_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Sqrt", "TestSqrtExample", NewTestSqrtExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Sqrt", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_sqrt_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSqrtExample version: 3. func NewTestSqrtExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_squeeze.go b/backend/testbackend/onnx/onnx_test_squeeze.go index 6dbaff6e..e379b90f 100644 --- a/backend/testbackend/onnx/onnx_test_squeeze.go +++ b/backend/testbackend/onnx/onnx_test_squeeze.go @@ -11,6 +11,123 @@ func init() { testbackend.Register("Squeeze", "TestSqueeze", NewTestSqueeze) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Squeeze", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_squeeze", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSqueeze version: 3. func NewTestSqueeze() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +143,7 @@ func NewTestSqueeze() *testbackend.TestCase { Name: "", OpType: "Squeeze", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000119d00)(name:"axes" type:INTS ints:0 ) + (*ir.AttributeProto)(0xc000216c00)(name:"axes" type:INTS ints:0 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_squeeze_negative_axes.go b/backend/testbackend/onnx/onnx_test_squeeze_negative_axes.go new file mode 100644 index 00000000..059d0a57 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_squeeze_negative_axes.go @@ -0,0 +1,169 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Squeeze", "TestSqueezeNegativeAxes", NewTestSqueezeNegativeAxes) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Squeeze", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_squeeze_negative_axes", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestSqueezeNegativeAxes version: 6. +func NewTestSqueezeNegativeAxes() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Squeeze", + Title: "TestSqueezeNegativeAxes", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x79, 0xa, 0x25, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x7, 0x53, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x12, 0x1a, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5a, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x5, 0x62, 0x17, 0xa, 0x1, 0x79, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Squeeze", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217000)(name:"axes" type:INTS ints:-2 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 3, 1, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 3, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_squeeze_negative_axes_test.go b/backend/testbackend/onnx/onnx_test_squeeze_negative_axes_test.go new file mode 100644 index 00000000..0ca95639 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_squeeze_negative_axes_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestSqueezeNegativeAxes(t *testing.T) { + mytest := NewTestSqueezeNegativeAxes() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_sub.go b/backend/testbackend/onnx/onnx_test_sub.go index 6b091277..44363ab9 100644 --- a/backend/testbackend/onnx/onnx_test_sub.go +++ b/backend/testbackend/onnx/onnx_test_sub.go @@ -11,6 +11,128 @@ func init() { testbackend.Register("Sub", "TestSub", NewTestSub) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Sub", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_sub", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSub version: 3. func NewTestSub() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_sub_bcast.go b/backend/testbackend/onnx/onnx_test_sub_bcast.go index 41045b12..05f5423d 100644 --- a/backend/testbackend/onnx/onnx_test_sub_bcast.go +++ b/backend/testbackend/onnx/onnx_test_sub_bcast.go @@ -11,6 +11,120 @@ func init() { testbackend.Register("Sub", "TestSubBcast", NewTestSubBcast) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Sub", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_sub_bcast", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSubBcast version: 3. func NewTestSubBcast() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_sub_example.go b/backend/testbackend/onnx/onnx_test_sub_example.go index 495fdadc..838856df 100644 --- a/backend/testbackend/onnx/onnx_test_sub_example.go +++ b/backend/testbackend/onnx/onnx_test_sub_example.go @@ -11,6 +11,104 @@ func init() { testbackend.Register("Sub", "TestSubExample", NewTestSubExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Sub", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_sub_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSubExample version: 3. func NewTestSubExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_sum_example.go b/backend/testbackend/onnx/onnx_test_sum_example.go index 502f880c..9bcf0763 100644 --- a/backend/testbackend/onnx/onnx_test_sum_example.go +++ b/backend/testbackend/onnx/onnx_test_sum_example.go @@ -11,6 +11,124 @@ func init() { testbackend.Register("Sum", "TestSumExample", NewTestSumExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data_0", "data_1", "data_2"}, + Output: {"result"}, + Name: "", + OpType: "Sum", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_sum_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data_0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "data_1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "data_2", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSumExample version: 3. func NewTestSumExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_sum_one_input.go b/backend/testbackend/onnx/onnx_test_sum_one_input.go index f25902d6..f8f79d23 100644 --- a/backend/testbackend/onnx/onnx_test_sum_one_input.go +++ b/backend/testbackend/onnx/onnx_test_sum_one_input.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Sum", "TestSumOneInput", NewTestSumOneInput) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data_0"}, + Output: {"result"}, + Name: "", + OpType: "Sum", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_sum_one_input", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data_0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSumOneInput version: 3. func NewTestSumOneInput() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_sum_two_inputs.go b/backend/testbackend/onnx/onnx_test_sum_two_inputs.go index 2ffeb2b4..8051e165 100644 --- a/backend/testbackend/onnx/onnx_test_sum_two_inputs.go +++ b/backend/testbackend/onnx/onnx_test_sum_two_inputs.go @@ -11,6 +11,104 @@ func init() { testbackend.Register("Sum", "TestSumTwoInputs", NewTestSumTwoInputs) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data_0", "data_1"}, + Output: {"result"}, + Name: "", + OpType: "Sum", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_sum_two_inputs", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data_0", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "data_1", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "result", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestSumTwoInputs version: 3. func NewTestSumTwoInputs() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_tan.go b/backend/testbackend/onnx/onnx_test_tan.go index a4755cbf..8bb4b99a 100644 --- a/backend/testbackend/onnx/onnx_test_tan.go +++ b/backend/testbackend/onnx/onnx_test_tan.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Tan", "TestTan", NewTestTan) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Tan", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_tan", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTan version: 3. func NewTestTan() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_tan_example.go b/backend/testbackend/onnx/onnx_test_tan_example.go index a6c814d1..0d45aaba 100644 --- a/backend/testbackend/onnx/onnx_test_tan_example.go +++ b/backend/testbackend/onnx/onnx_test_tan_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Tan", "TestTanExample", NewTestTanExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Tan", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_tan_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTanExample version: 3. func NewTestTanExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_tanh.go b/backend/testbackend/onnx/onnx_test_tanh.go index 99f48015..0b6d9ab7 100644 --- a/backend/testbackend/onnx/onnx_test_tanh.go +++ b/backend/testbackend/onnx/onnx_test_tanh.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Tanh", "TestTanh", NewTestTanh) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Tanh", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_tanh", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTanh version: 3. func NewTestTanh() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_tanh_example.go b/backend/testbackend/onnx/onnx_test_tanh_example.go index fb008d25..5508e003 100644 --- a/backend/testbackend/onnx/onnx_test_tanh_example.go +++ b/backend/testbackend/onnx/onnx_test_tanh_example.go @@ -11,6 +11,84 @@ func init() { testbackend.Register("Tanh", "TestTanhExample", NewTestTanhExample) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Tanh", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_tanh_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTanhExample version: 3. func NewTestTanhExample() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_batch_onlybigrams_skip0.go b/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_batch_onlybigrams_skip0.go index efbc73f5..80b3ae20 100644 --- a/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_batch_onlybigrams_skip0.go +++ b/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_batch_onlybigrams_skip0.go @@ -11,6 +11,219 @@ func init() { testbackend.Register("TfIdfVectorizer", "TestTfidfvectorizerTfBatchOnlybigramsSkip0", NewTestTfidfvectorizerTfBatchOnlybigramsSkip0) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X"}, + Output: {"Y"}, + Name: "", + OpType: "TfIdfVectorizer", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "max_gram_length", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "max_skip_count", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "min_gram_length", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "mode", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x54, 0x46}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "ngram_counts", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 4}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "ngram_indexes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 1, 2, 3, 4, 5, 6}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pool_int64s", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 3, 5, 4, 5, 6, 7, 8, 6, 7}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_tfidfvectorizer_tf_batch_onlybigrams_skip0", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTfidfvectorizerTfBatchOnlybigramsSkip0 version: 3. func NewTestTfidfvectorizerTfBatchOnlybigramsSkip0() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,13 +239,13 @@ func NewTestTfidfvectorizerTfBatchOnlybigramsSkip0() *testbackend.TestCase { Name: "", OpType: "TfIdfVectorizer", Attributes: ([]*ir.AttributeProto) (len=7 cap=8) { - (*ir.AttributeProto)(0xc000133a00)(name:"max_gram_length" type:INT i:2 ), - (*ir.AttributeProto)(0xc000133b00)(name:"max_skip_count" type:INT ), - (*ir.AttributeProto)(0xc000133c00)(name:"min_gram_length" type:INT i:2 ), - (*ir.AttributeProto)(0xc000133d00)(name:"mode" type:STRING s:"TF" ), - (*ir.AttributeProto)(0xc000133e00)(name:"ngram_counts" type:INTS ints:0 ints:4 ), - (*ir.AttributeProto)(0xc000133f00)(name:"ngram_indexes" type:INTS ints:0 ints:1 ints:2 ints:3 ints:4 ints:5 ints:6 ), - (*ir.AttributeProto)(0xc0001fc000)(name:"pool_int64s" type:INTS ints:2 ints:3 ints:5 ints:4 ints:5 ints:6 ints:7 ints:8 ints:6 ints:7 ) + (*ir.AttributeProto)(0xc0001e6400)(name:"max_gram_length" type:INT i:2 ), + (*ir.AttributeProto)(0xc0001e6500)(name:"max_skip_count" type:INT ), + (*ir.AttributeProto)(0xc0001e6600)(name:"min_gram_length" type:INT i:2 ), + (*ir.AttributeProto)(0xc0001e6700)(name:"mode" type:STRING s:"TF" ), + (*ir.AttributeProto)(0xc0002a2000)(name:"ngram_counts" type:INTS ints:0 ints:4 ), + (*ir.AttributeProto)(0xc0002a2100)(name:"ngram_indexes" type:INTS ints:0 ints:1 ints:2 ints:3 ints:4 ints:5 ints:6 ), + (*ir.AttributeProto)(0xc0002a2200)(name:"pool_int64s" type:INTS ints:2 ints:3 ints:5 ints:4 ints:5 ints:6 ints:7 ints:8 ints:6 ints:7 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_batch_onlybigrams_skip5.go b/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_batch_onlybigrams_skip5.go index 9c83b9b1..a3938f45 100644 --- a/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_batch_onlybigrams_skip5.go +++ b/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_batch_onlybigrams_skip5.go @@ -11,6 +11,219 @@ func init() { testbackend.Register("TfIdfVectorizer", "TestTfidfvectorizerTfBatchOnlybigramsSkip5", NewTestTfidfvectorizerTfBatchOnlybigramsSkip5) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X"}, + Output: {"Y"}, + Name: "", + OpType: "TfIdfVectorizer", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "max_gram_length", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "max_skip_count", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 5, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "min_gram_length", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "mode", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x54, 0x46}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "ngram_counts", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 4}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "ngram_indexes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 1, 2, 3, 4, 5, 6}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pool_int64s", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 3, 5, 4, 5, 6, 7, 8, 6, 7}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_tfidfvectorizer_tf_batch_onlybigrams_skip5", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTfidfvectorizerTfBatchOnlybigramsSkip5 version: 3. func NewTestTfidfvectorizerTfBatchOnlybigramsSkip5() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,13 +239,13 @@ func NewTestTfidfvectorizerTfBatchOnlybigramsSkip5() *testbackend.TestCase { Name: "", OpType: "TfIdfVectorizer", Attributes: ([]*ir.AttributeProto) (len=7 cap=8) { - (*ir.AttributeProto)(0xc0001fc100)(name:"max_gram_length" type:INT i:2 ), - (*ir.AttributeProto)(0xc0001fc200)(name:"max_skip_count" type:INT i:5 ), - (*ir.AttributeProto)(0xc0001fc300)(name:"min_gram_length" type:INT i:2 ), - (*ir.AttributeProto)(0xc0001fc400)(name:"mode" type:STRING s:"TF" ), - (*ir.AttributeProto)(0xc0001fc500)(name:"ngram_counts" type:INTS ints:0 ints:4 ), - (*ir.AttributeProto)(0xc0001fc600)(name:"ngram_indexes" type:INTS ints:0 ints:1 ints:2 ints:3 ints:4 ints:5 ints:6 ), - (*ir.AttributeProto)(0xc0001fc700)(name:"pool_int64s" type:INTS ints:2 ints:3 ints:5 ints:4 ints:5 ints:6 ints:7 ints:8 ints:6 ints:7 ) + (*ir.AttributeProto)(0xc0001e6100)(name:"max_gram_length" type:INT i:2 ), + (*ir.AttributeProto)(0xc0001e6400)(name:"max_skip_count" type:INT i:5 ), + (*ir.AttributeProto)(0xc0001e6500)(name:"min_gram_length" type:INT i:2 ), + (*ir.AttributeProto)(0xc0001e6600)(name:"mode" type:STRING s:"TF" ), + (*ir.AttributeProto)(0xc0001e6700)(name:"ngram_counts" type:INTS ints:0 ints:4 ), + (*ir.AttributeProto)(0xc000216b00)(name:"ngram_indexes" type:INTS ints:0 ints:1 ints:2 ints:3 ints:4 ints:5 ints:6 ), + (*ir.AttributeProto)(0xc000216c00)(name:"pool_int64s" type:INTS ints:2 ints:3 ints:5 ints:4 ints:5 ints:6 ints:7 ints:8 ints:6 ints:7 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_batch_uniandbigrams_skip5.go b/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_batch_uniandbigrams_skip5.go index 13d4701c..f513a155 100644 --- a/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_batch_uniandbigrams_skip5.go +++ b/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_batch_uniandbigrams_skip5.go @@ -11,6 +11,219 @@ func init() { testbackend.Register("TfIdfVectorizer", "TestTfidfvectorizerTfBatchUniandbigramsSkip5", NewTestTfidfvectorizerTfBatchUniandbigramsSkip5) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X"}, + Output: {"Y"}, + Name: "", + OpType: "TfIdfVectorizer", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "max_gram_length", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "max_skip_count", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 5, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "min_gram_length", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "mode", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x54, 0x46}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "ngram_counts", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 4}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "ngram_indexes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 1, 2, 3, 4, 5, 6}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pool_int64s", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 3, 5, 4, 5, 6, 7, 8, 6, 7}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_tfidfvectorizer_tf_batch_uniandbigrams_skip5", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTfidfvectorizerTfBatchUniandbigramsSkip5 version: 3. func NewTestTfidfvectorizerTfBatchUniandbigramsSkip5() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,13 +239,13 @@ func NewTestTfidfvectorizerTfBatchUniandbigramsSkip5() *testbackend.TestCase { Name: "", OpType: "TfIdfVectorizer", Attributes: ([]*ir.AttributeProto) (len=7 cap=8) { - (*ir.AttributeProto)(0xc0002cc100)(name:"max_gram_length" type:INT i:2 ), - (*ir.AttributeProto)(0xc0002cc200)(name:"max_skip_count" type:INT i:5 ), - (*ir.AttributeProto)(0xc0002cc300)(name:"min_gram_length" type:INT i:1 ), - (*ir.AttributeProto)(0xc0002cc400)(name:"mode" type:STRING s:"TF" ), - (*ir.AttributeProto)(0xc0002cc500)(name:"ngram_counts" type:INTS ints:0 ints:4 ), - (*ir.AttributeProto)(0xc0002cc600)(name:"ngram_indexes" type:INTS ints:0 ints:1 ints:2 ints:3 ints:4 ints:5 ints:6 ), - (*ir.AttributeProto)(0xc0002cc700)(name:"pool_int64s" type:INTS ints:2 ints:3 ints:5 ints:4 ints:5 ints:6 ints:7 ints:8 ints:6 ints:7 ) + (*ir.AttributeProto)(0xc000217000)(name:"max_gram_length" type:INT i:2 ), + (*ir.AttributeProto)(0xc000217100)(name:"max_skip_count" type:INT i:5 ), + (*ir.AttributeProto)(0xc000217200)(name:"min_gram_length" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217300)(name:"mode" type:STRING s:"TF" ), + (*ir.AttributeProto)(0xc000217400)(name:"ngram_counts" type:INTS ints:0 ints:4 ), + (*ir.AttributeProto)(0xc000217c00)(name:"ngram_indexes" type:INTS ints:0 ints:1 ints:2 ints:3 ints:4 ints:5 ints:6 ), + (*ir.AttributeProto)(0xc000217d00)(name:"pool_int64s" type:INTS ints:2 ints:3 ints:5 ints:4 ints:5 ints:6 ints:7 ints:8 ints:6 ints:7 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_only_bigrams_skip0.go b/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_only_bigrams_skip0.go index 02ebd18d..19a92504 100644 --- a/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_only_bigrams_skip0.go +++ b/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_only_bigrams_skip0.go @@ -11,6 +11,211 @@ func init() { testbackend.Register("TfIdfVectorizer", "TestTfidfvectorizerTfOnlyBigramsSkip0", NewTestTfidfvectorizerTfOnlyBigramsSkip0) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X"}, + Output: {"Y"}, + Name: "", + OpType: "TfIdfVectorizer", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "max_gram_length", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "max_skip_count", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "min_gram_length", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "mode", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x54, 0x46}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "ngram_counts", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 4}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "ngram_indexes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 1, 2, 3, 4, 5, 6}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pool_int64s", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 3, 5, 4, 5, 6, 7, 8, 6, 7}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_tfidfvectorizer_tf_only_bigrams_skip0", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:12}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTfidfvectorizerTfOnlyBigramsSkip0 version: 3. func NewTestTfidfvectorizerTfOnlyBigramsSkip0() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,13 +231,13 @@ func NewTestTfidfvectorizerTfOnlyBigramsSkip0() *testbackend.TestCase { Name: "", OpType: "TfIdfVectorizer", Attributes: ([]*ir.AttributeProto) (len=7 cap=8) { - (*ir.AttributeProto)(0xc0002ccd00)(name:"max_gram_length" type:INT i:2 ), - (*ir.AttributeProto)(0xc0002cce00)(name:"max_skip_count" type:INT ), - (*ir.AttributeProto)(0xc0002ccf00)(name:"min_gram_length" type:INT i:2 ), - (*ir.AttributeProto)(0xc0002cd000)(name:"mode" type:STRING s:"TF" ), - (*ir.AttributeProto)(0xc0002cd100)(name:"ngram_counts" type:INTS ints:0 ints:4 ), - (*ir.AttributeProto)(0xc0002cd200)(name:"ngram_indexes" type:INTS ints:0 ints:1 ints:2 ints:3 ints:4 ints:5 ints:6 ), - (*ir.AttributeProto)(0xc0002cd300)(name:"pool_int64s" type:INTS ints:2 ints:3 ints:5 ints:4 ints:5 ints:6 ints:7 ints:8 ints:6 ints:7 ) + (*ir.AttributeProto)(0xc0002a2100)(name:"max_gram_length" type:INT i:2 ), + (*ir.AttributeProto)(0xc0002a2200)(name:"max_skip_count" type:INT ), + (*ir.AttributeProto)(0xc0002a2300)(name:"min_gram_length" type:INT i:2 ), + (*ir.AttributeProto)(0xc0002a2600)(name:"mode" type:STRING s:"TF" ), + (*ir.AttributeProto)(0xc0002a2700)(name:"ngram_counts" type:INTS ints:0 ints:4 ), + (*ir.AttributeProto)(0xc0002a2800)(name:"ngram_indexes" type:INTS ints:0 ints:1 ints:2 ints:3 ints:4 ints:5 ints:6 ), + (*ir.AttributeProto)(0xc0002a2900)(name:"pool_int64s" type:INTS ints:2 ints:3 ints:5 ints:4 ints:5 ints:6 ints:7 ints:8 ints:6 ints:7 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_onlybigrams_levelempty.go b/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_onlybigrams_levelempty.go index c17e0bc6..1c2b89da 100644 --- a/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_onlybigrams_levelempty.go +++ b/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_onlybigrams_levelempty.go @@ -11,6 +11,211 @@ func init() { testbackend.Register("TfIdfVectorizer", "TestTfidfvectorizerTfOnlybigramsLevelempty", NewTestTfidfvectorizerTfOnlybigramsLevelempty) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X"}, + Output: {"Y"}, + Name: "", + OpType: "TfIdfVectorizer", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "max_gram_length", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "max_skip_count", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "min_gram_length", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "mode", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x54, 0x46}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "ngram_counts", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 0}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "ngram_indexes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 1, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pool_int64s", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {5, 6, 7, 8, 6, 7}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_tfidfvectorizer_tf_onlybigrams_levelempty", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:12}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTfidfvectorizerTfOnlybigramsLevelempty version: 3. func NewTestTfidfvectorizerTfOnlybigramsLevelempty() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,13 +231,13 @@ func NewTestTfidfvectorizerTfOnlybigramsLevelempty() *testbackend.TestCase { Name: "", OpType: "TfIdfVectorizer", Attributes: ([]*ir.AttributeProto) (len=7 cap=8) { - (*ir.AttributeProto)(0xc0002cd400)(name:"max_gram_length" type:INT i:2 ), - (*ir.AttributeProto)(0xc0002cd500)(name:"max_skip_count" type:INT ), - (*ir.AttributeProto)(0xc0002cd600)(name:"min_gram_length" type:INT i:2 ), - (*ir.AttributeProto)(0xc0002cd700)(name:"mode" type:STRING s:"TF" ), - (*ir.AttributeProto)(0xc0002cd800)(name:"ngram_counts" type:INTS ints:0 ints:0 ), - (*ir.AttributeProto)(0xc0002cd900)(name:"ngram_indexes" type:INTS ints:0 ints:1 ints:2 ), - (*ir.AttributeProto)(0xc0002cda00)(name:"pool_int64s" type:INTS ints:5 ints:6 ints:7 ints:8 ints:6 ints:7 ) + (*ir.AttributeProto)(0xc0002a2c00)(name:"max_gram_length" type:INT i:2 ), + (*ir.AttributeProto)(0xc0002a2d00)(name:"max_skip_count" type:INT ), + (*ir.AttributeProto)(0xc0002a2e00)(name:"min_gram_length" type:INT i:2 ), + (*ir.AttributeProto)(0xc0002a2f00)(name:"mode" type:STRING s:"TF" ), + (*ir.AttributeProto)(0xc0002a3000)(name:"ngram_counts" type:INTS ints:0 ints:0 ), + (*ir.AttributeProto)(0xc0002a3100)(name:"ngram_indexes" type:INTS ints:0 ints:1 ints:2 ), + (*ir.AttributeProto)(0xc0002a3200)(name:"pool_int64s" type:INTS ints:5 ints:6 ints:7 ints:8 ints:6 ints:7 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_onlybigrams_skip5.go b/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_onlybigrams_skip5.go index 5a483920..4d7f48c9 100644 --- a/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_onlybigrams_skip5.go +++ b/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_onlybigrams_skip5.go @@ -11,6 +11,211 @@ func init() { testbackend.Register("TfIdfVectorizer", "TestTfidfvectorizerTfOnlybigramsSkip5", NewTestTfidfvectorizerTfOnlybigramsSkip5) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X"}, + Output: {"Y"}, + Name: "", + OpType: "TfIdfVectorizer", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "max_gram_length", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "max_skip_count", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 5, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "min_gram_length", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "mode", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x54, 0x46}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "ngram_counts", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 4}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "ngram_indexes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 1, 2, 3, 4, 5, 6}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pool_int64s", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 3, 5, 4, 5, 6, 7, 8, 6, 7}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_tfidfvectorizer_tf_onlybigrams_skip5", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:12}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTfidfvectorizerTfOnlybigramsSkip5 version: 3. func NewTestTfidfvectorizerTfOnlybigramsSkip5() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,13 +231,13 @@ func NewTestTfidfvectorizerTfOnlybigramsSkip5() *testbackend.TestCase { Name: "", OpType: "TfIdfVectorizer", Attributes: ([]*ir.AttributeProto) (len=7 cap=8) { - (*ir.AttributeProto)(0xc000126500)(name:"max_gram_length" type:INT i:2 ), - (*ir.AttributeProto)(0xc000126600)(name:"max_skip_count" type:INT i:5 ), - (*ir.AttributeProto)(0xc000126700)(name:"min_gram_length" type:INT i:2 ), - (*ir.AttributeProto)(0xc000126800)(name:"mode" type:STRING s:"TF" ), - (*ir.AttributeProto)(0xc000126900)(name:"ngram_counts" type:INTS ints:0 ints:4 ), - (*ir.AttributeProto)(0xc000126a00)(name:"ngram_indexes" type:INTS ints:0 ints:1 ints:2 ints:3 ints:4 ints:5 ints:6 ), - (*ir.AttributeProto)(0xc000126b00)(name:"pool_int64s" type:INTS ints:2 ints:3 ints:5 ints:4 ints:5 ints:6 ints:7 ints:8 ints:6 ints:7 ) + (*ir.AttributeProto)(0xc0002a3500)(name:"max_gram_length" type:INT i:2 ), + (*ir.AttributeProto)(0xc0002a3600)(name:"max_skip_count" type:INT i:5 ), + (*ir.AttributeProto)(0xc0002a3700)(name:"min_gram_length" type:INT i:2 ), + (*ir.AttributeProto)(0xc0002a3800)(name:"mode" type:STRING s:"TF" ), + (*ir.AttributeProto)(0xc0002a3900)(name:"ngram_counts" type:INTS ints:0 ints:4 ), + (*ir.AttributeProto)(0xc0002a3a00)(name:"ngram_indexes" type:INTS ints:0 ints:1 ints:2 ints:3 ints:4 ints:5 ints:6 ), + (*ir.AttributeProto)(0xc0002a3b00)(name:"pool_int64s" type:INTS ints:2 ints:3 ints:5 ints:4 ints:5 ints:6 ints:7 ints:8 ints:6 ints:7 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_uniandbigrams_skip5.go b/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_uniandbigrams_skip5.go index 429e5860..dcf11bcb 100644 --- a/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_uniandbigrams_skip5.go +++ b/backend/testbackend/onnx/onnx_test_tfidfvectorizer_tf_uniandbigrams_skip5.go @@ -11,6 +11,211 @@ func init() { testbackend.Register("TfIdfVectorizer", "TestTfidfvectorizerTfUniandbigramsSkip5", NewTestTfidfvectorizerTfUniandbigramsSkip5) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X"}, + Output: {"Y"}, + Name: "", + OpType: "TfIdfVectorizer", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "max_gram_length", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 2, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "max_skip_count", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 5, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "min_gram_length", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "mode", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x54, 0x46}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "ngram_counts", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 4}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "ngram_indexes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 1, 2, 3, 4, 5, 6}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "pool_int64s", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 3, 5, 4, 5, 6, 7, 8, 6, 7}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_tfidfvectorizer_tf_uniandbigrams_skip5", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 6, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:12}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:7}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTfidfvectorizerTfUniandbigramsSkip5 version: 3. func NewTestTfidfvectorizerTfUniandbigramsSkip5() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,13 +231,13 @@ func NewTestTfidfvectorizerTfUniandbigramsSkip5() *testbackend.TestCase { Name: "", OpType: "TfIdfVectorizer", Attributes: ([]*ir.AttributeProto) (len=7 cap=8) { - (*ir.AttributeProto)(0xc000118800)(name:"max_gram_length" type:INT i:2 ), - (*ir.AttributeProto)(0xc000118900)(name:"max_skip_count" type:INT i:5 ), - (*ir.AttributeProto)(0xc000118a00)(name:"min_gram_length" type:INT i:1 ), - (*ir.AttributeProto)(0xc000118b00)(name:"mode" type:STRING s:"TF" ), - (*ir.AttributeProto)(0xc000118c00)(name:"ngram_counts" type:INTS ints:0 ints:4 ), - (*ir.AttributeProto)(0xc000118d00)(name:"ngram_indexes" type:INTS ints:0 ints:1 ints:2 ints:3 ints:4 ints:5 ints:6 ), - (*ir.AttributeProto)(0xc000118e00)(name:"pool_int64s" type:INTS ints:2 ints:3 ints:5 ints:4 ints:5 ints:6 ints:7 ints:8 ints:6 ints:7 ) + (*ir.AttributeProto)(0xc000216d00)(name:"max_gram_length" type:INT i:2 ), + (*ir.AttributeProto)(0xc000216e00)(name:"max_skip_count" type:INT i:5 ), + (*ir.AttributeProto)(0xc000216f00)(name:"min_gram_length" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217000)(name:"mode" type:STRING s:"TF" ), + (*ir.AttributeProto)(0xc000217100)(name:"ngram_counts" type:INTS ints:0 ints:4 ), + (*ir.AttributeProto)(0xc000217200)(name:"ngram_indexes" type:INTS ints:0 ints:1 ints:2 ints:3 ints:4 ints:5 ints:6 ), + (*ir.AttributeProto)(0xc000217300)(name:"pool_int64s" type:INTS ints:2 ints:3 ints:5 ints:4 ints:5 ints:6 ints:7 ints:8 ints:6 ints:7 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_thresholdedrelu.go b/backend/testbackend/onnx/onnx_test_thresholdedrelu.go index 57e2d045..3924accc 100644 --- a/backend/testbackend/onnx/onnx_test_thresholdedrelu.go +++ b/backend/testbackend/onnx/onnx_test_thresholdedrelu.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("ThresholdedRelu", "TestThresholdedrelu", NewTestThresholdedrelu) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "ThresholdedRelu", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "alpha", + RefAttrName: "", + DocString: "", + Type: 1, + F: 2, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_thresholdedrelu", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestThresholdedrelu version: 4. func NewTestThresholdedrelu() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestThresholdedrelu() *testbackend.TestCase { Name: "", OpType: "ThresholdedRelu", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000127000)(name:"alpha" type:FLOAT f:2 ) + (*ir.AttributeProto)(0xc000217d00)(name:"alpha" type:FLOAT f:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_thresholdedrelu_default.go b/backend/testbackend/onnx/onnx_test_thresholdedrelu_default.go index 3e765789..7007e7ee 100644 --- a/backend/testbackend/onnx/onnx_test_thresholdedrelu_default.go +++ b/backend/testbackend/onnx/onnx_test_thresholdedrelu_default.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("ThresholdedRelu", "TestThresholdedreluDefault", NewTestThresholdedreluDefault) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "ThresholdedRelu", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_thresholdedrelu_default", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestThresholdedreluDefault version: 4. func NewTestThresholdedreluDefault() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_thresholdedrelu_example.go b/backend/testbackend/onnx/onnx_test_thresholdedrelu_example.go index 9885523e..5518177a 100644 --- a/backend/testbackend/onnx/onnx_test_thresholdedrelu_example.go +++ b/backend/testbackend/onnx/onnx_test_thresholdedrelu_example.go @@ -11,6 +11,103 @@ func init() { testbackend.Register("ThresholdedRelu", "TestThresholdedreluExample", NewTestThresholdedreluExample) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:10}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "ThresholdedRelu", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "alpha", + RefAttrName: "", + DocString: "", + Type: 1, + F: 2, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_thresholdedrelu_example", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestThresholdedreluExample version: 4. func NewTestThresholdedreluExample() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +123,7 @@ func NewTestThresholdedreluExample() *testbackend.TestCase { Name: "", OpType: "ThresholdedRelu", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000119400)(name:"alpha" type:FLOAT f:2 ) + (*ir.AttributeProto)(0xc0001e6700)(name:"alpha" type:FLOAT f:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_tile.go b/backend/testbackend/onnx/onnx_test_tile.go index 29f2a442..3bec36dd 100644 --- a/backend/testbackend/onnx/onnx_test_tile.go +++ b/backend/testbackend/onnx/onnx_test_tile.go @@ -11,6 +11,128 @@ func init() { testbackend.Register("Tile", "TestTile", NewTestTile) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Tile", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_tile", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:14}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:18}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:16}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:10}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTile version: 3. func NewTestTile() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_tile_precomputed.go b/backend/testbackend/onnx/onnx_test_tile_precomputed.go index f9730873..9f5bfb78 100644 --- a/backend/testbackend/onnx/onnx_test_tile_precomputed.go +++ b/backend/testbackend/onnx/onnx_test_tile_precomputed.go @@ -11,6 +11,112 @@ func init() { testbackend.Register("Tile", "TestTilePrecomputed", NewTestTilePrecomputed) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "y"}, + Output: {"z"}, + Name: "", + OpType: "Tile", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_tile_precomputed", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "z", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTilePrecomputed version: 3. func NewTestTilePrecomputed() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_top_k.go b/backend/testbackend/onnx/onnx_test_top_k.go index 1a88a38d..a11b352b 100644 --- a/backend/testbackend/onnx/onnx_test_top_k.go +++ b/backend/testbackend/onnx/onnx_test_top_k.go @@ -11,12 +11,161 @@ func init() { testbackend.Register("TopK", "TestTopK", NewTestTopK) } -// NewTestTopK version: 4. +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "k"}, + Output: {"values", "indices"}, + Name: "", + OpType: "TopK", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_top_k", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "k", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "values", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestTopK version: 5. func NewTestTopK() *testbackend.TestCase { return &testbackend.TestCase{ OpType: "TopK", Title: "TestTopK", - ModelB: []byte{0x8, 0x4, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x86, 0x1, 0xa, 0x1d, 0xa, 0x1, 0x78, 0xa, 0x1, 0x6b, 0x12, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x22, 0x4, 0x54, 0x6f, 0x70, 0x4b, 0x12, 0xa, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x6f, 0x70, 0x5f, 0x6b, 0x5a, 0x13, 0xa, 0x1, 0x78, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0xf, 0xa, 0x1, 0x6b, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x62, 0x18, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x62, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xa}, + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x93, 0x1, 0xa, 0x2a, 0xa, 0x1, 0x78, 0xa, 0x1, 0x6b, 0x12, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x22, 0x4, 0x54, 0x6f, 0x70, 0x4b, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0xa, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x6f, 0x70, 0x5f, 0x6b, 0x5a, 0x13, 0xa, 0x1, 0x78, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0xf, 0xa, 0x1, 0x6b, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x62, 0x18, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x62, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, /* @@ -25,7 +174,9 @@ func NewTestTopK() *testbackend.TestCase { Output: []string{"values", "indices"}, Name: "", OpType: "TopK", - Attributes: ([]*ir.AttributeProto) + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0001e6600)(name:"axis" type:INT i:1 ) + } , }, diff --git a/backend/testbackend/onnx/onnx_test_top_k_negative_axis.go b/backend/testbackend/onnx/onnx_test_top_k_negative_axis.go new file mode 100644 index 00000000..3a48efa6 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_top_k_negative_axis.go @@ -0,0 +1,211 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("TopK", "TestTopKNegativeAxis", NewTestTopKNegativeAxis) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "k"}, + Output: {"values", "indices"}, + Name: "", + OpType: "TopK", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_top_k_negative_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "k", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "values", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestTopKNegativeAxis version: 6. +func NewTestTopKNegativeAxis() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "TopK", + Title: "TestTopKNegativeAxis", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xaa, 0x1, 0xa, 0x33, 0xa, 0x1, 0x78, 0xa, 0x1, 0x6b, 0x12, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x22, 0x4, 0x54, 0x6f, 0x70, 0x4b, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x18, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x6f, 0x70, 0x5f, 0x6b, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x13, 0xa, 0x1, 0x78, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0xf, 0xa, 0x1, 0x6b, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x62, 0x18, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x62, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x", "k"}, + Output: []string{"values", "indices"}, + Name: "", + OpType: "TopK", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000216f00)(name:"axis" type:INT i:-1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4), + tensor.WithBacking([]float32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{3}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 3), + tensor.WithBacking([]float32{3, 2, 1, 7, 6, 5, 11, 10, 9}), + ), + + tensor.New( + tensor.WithShape(3, 3), + tensor.WithBacking([]int64{3, 2, 1, 3, 2, 1, 3, 2, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_top_k_negative_axis_test.go b/backend/testbackend/onnx/onnx_test_top_k_negative_axis_test.go new file mode 100644 index 00000000..d178d2bc --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_top_k_negative_axis_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestTopKNegativeAxis(t *testing.T) { + mytest := NewTestTopKNegativeAxis() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_top_k_smallest.go b/backend/testbackend/onnx/onnx_test_top_k_smallest.go new file mode 100644 index 00000000..eb5e8eed --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_top_k_smallest.go @@ -0,0 +1,249 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("TopK", "TestTopKSmallest", NewTestTopKSmallest) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x", "k"}, + Output: {"values", "indices"}, + Name: "", + OpType: "TopK", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "largest", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "sorted", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_top_k_smallest", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "k", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "values", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestTopKSmallest version: 5. +func NewTestTopKSmallest() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "TopK", + Title: "TestTopKSmallest", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xbb, 0x1, 0xa, 0x49, 0xa, 0x1, 0x78, 0xa, 0x1, 0x6b, 0x12, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x22, 0x4, 0x54, 0x6f, 0x70, 0x4b, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xe, 0xa, 0x7, 0x6c, 0x61, 0x72, 0x67, 0x65, 0x73, 0x74, 0x18, 0x0, 0xa0, 0x1, 0x2, 0x2a, 0xd, 0xa, 0x6, 0x73, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x13, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x74, 0x6f, 0x70, 0x5f, 0x6b, 0x5f, 0x73, 0x6d, 0x61, 0x6c, 0x6c, 0x65, 0x73, 0x74, 0x5a, 0x13, 0xa, 0x1, 0x78, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0x5a, 0xf, 0xa, 0x1, 0x6b, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x1, 0x62, 0x18, 0xa, 0x6, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x62, 0x19, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xe, 0xa, 0xc, 0x8, 0x7, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x", "k"}, + Output: []string{"values", "indices"}, + Name: "", + OpType: "TopK", + Attributes: ([]*ir.AttributeProto) (len=3 cap=4) { + (*ir.AttributeProto)(0xc000217c00)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc000217d00)(name:"largest" type:INT ), + (*ir.AttributeProto)(0xc000217e00)(name:"sorted" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4), + tensor.WithBacking([]float32{0, 1, 2, 3, 4, 5, 6, 7, 11, 10, 9, 8}), + ), + + tensor.New( + tensor.WithShape(1), + tensor.WithBacking([]float32{3}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 3), + tensor.WithBacking([]float32{0, 1, 2, 4, 5, 6, 8, 9, 10}), + ), + + tensor.New( + tensor.WithShape(3, 3), + tensor.WithBacking([]int64{0, 1, 2, 0, 1, 2, 3, 2, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_top_k_smallest_test.go b/backend/testbackend/onnx/onnx_test_top_k_smallest_test.go new file mode 100644 index 00000000..36f0ee4f --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_top_k_smallest_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestTopKSmallest(t *testing.T) { + mytest := NewTestTopKSmallest() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_transpose_all_permutations_0.go b/backend/testbackend/onnx/onnx_test_transpose_all_permutations_0.go index 63f384e2..feb00abf 100644 --- a/backend/testbackend/onnx/onnx_test_transpose_all_permutations_0.go +++ b/backend/testbackend/onnx/onnx_test_transpose_all_permutations_0.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("Transpose", "TestTransposeAllPermutations0", NewTestTransposeAllPermutations0) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"transposed"}, + Name: "", + OpType: "Transpose", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "perm", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 1, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_transpose_all_permutations_0", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "transposed", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTransposeAllPermutations0 version: 3. func NewTestTransposeAllPermutations0() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestTransposeAllPermutations0() *testbackend.TestCase { Name: "", OpType: "Transpose", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126600)(name:"perm" type:INTS ints:0 ints:1 ints:2 ) + (*ir.AttributeProto)(0xc0002d4400)(name:"perm" type:INTS ints:0 ints:1 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_transpose_all_permutations_1.go b/backend/testbackend/onnx/onnx_test_transpose_all_permutations_1.go index db526984..dbd96f83 100644 --- a/backend/testbackend/onnx/onnx_test_transpose_all_permutations_1.go +++ b/backend/testbackend/onnx/onnx_test_transpose_all_permutations_1.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("Transpose", "TestTransposeAllPermutations1", NewTestTransposeAllPermutations1) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"transposed"}, + Name: "", + OpType: "Transpose", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "perm", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0, 2, 1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_transpose_all_permutations_1", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "transposed", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTransposeAllPermutations1 version: 3. func NewTestTransposeAllPermutations1() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestTransposeAllPermutations1() *testbackend.TestCase { Name: "", OpType: "Transpose", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126000)(name:"perm" type:INTS ints:0 ints:2 ints:1 ) + (*ir.AttributeProto)(0xc0002d4800)(name:"perm" type:INTS ints:0 ints:2 ints:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_transpose_all_permutations_2.go b/backend/testbackend/onnx/onnx_test_transpose_all_permutations_2.go index 5bd41251..02863e1d 100644 --- a/backend/testbackend/onnx/onnx_test_transpose_all_permutations_2.go +++ b/backend/testbackend/onnx/onnx_test_transpose_all_permutations_2.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("Transpose", "TestTransposeAllPermutations2", NewTestTransposeAllPermutations2) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"transposed"}, + Name: "", + OpType: "Transpose", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "perm", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1, 0, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_transpose_all_permutations_2", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "transposed", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTransposeAllPermutations2 version: 3. func NewTestTransposeAllPermutations2() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestTransposeAllPermutations2() *testbackend.TestCase { Name: "", OpType: "Transpose", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126100)(name:"perm" type:INTS ints:1 ints:0 ints:2 ) + (*ir.AttributeProto)(0xc000216b00)(name:"perm" type:INTS ints:1 ints:0 ints:2 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_transpose_all_permutations_3.go b/backend/testbackend/onnx/onnx_test_transpose_all_permutations_3.go index 993aeaa6..599778bd 100644 --- a/backend/testbackend/onnx/onnx_test_transpose_all_permutations_3.go +++ b/backend/testbackend/onnx/onnx_test_transpose_all_permutations_3.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("Transpose", "TestTransposeAllPermutations3", NewTestTransposeAllPermutations3) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"transposed"}, + Name: "", + OpType: "Transpose", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "perm", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1, 2, 0}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_transpose_all_permutations_3", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "transposed", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTransposeAllPermutations3 version: 3. func NewTestTransposeAllPermutations3() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestTransposeAllPermutations3() *testbackend.TestCase { Name: "", OpType: "Transpose", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000126800)(name:"perm" type:INTS ints:1 ints:2 ints:0 ) + (*ir.AttributeProto)(0xc000216f00)(name:"perm" type:INTS ints:1 ints:2 ints:0 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_transpose_all_permutations_4.go b/backend/testbackend/onnx/onnx_test_transpose_all_permutations_4.go index 6a7460b4..c1f23ba3 100644 --- a/backend/testbackend/onnx/onnx_test_transpose_all_permutations_4.go +++ b/backend/testbackend/onnx/onnx_test_transpose_all_permutations_4.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("Transpose", "TestTransposeAllPermutations4", NewTestTransposeAllPermutations4) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"transposed"}, + Name: "", + OpType: "Transpose", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "perm", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 0, 1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_transpose_all_permutations_4", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "transposed", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTransposeAllPermutations4 version: 3. func NewTestTransposeAllPermutations4() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestTransposeAllPermutations4() *testbackend.TestCase { Name: "", OpType: "Transpose", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000132e00)(name:"perm" type:INTS ints:2 ints:0 ints:1 ) + (*ir.AttributeProto)(0xc000217300)(name:"perm" type:INTS ints:2 ints:0 ints:1 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_transpose_all_permutations_5.go b/backend/testbackend/onnx/onnx_test_transpose_all_permutations_5.go index 15e5b3b6..c0e6c291 100644 --- a/backend/testbackend/onnx/onnx_test_transpose_all_permutations_5.go +++ b/backend/testbackend/onnx/onnx_test_transpose_all_permutations_5.go @@ -11,6 +11,119 @@ func init() { testbackend.Register("Transpose", "TestTransposeAllPermutations5", NewTestTransposeAllPermutations5) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"transposed"}, + Name: "", + OpType: "Transpose", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "perm", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 1, 0}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_transpose_all_permutations_5", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "transposed", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTransposeAllPermutations5 version: 3. func NewTestTransposeAllPermutations5() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +139,7 @@ func NewTestTransposeAllPermutations5() *testbackend.TestCase { Name: "", OpType: "Transpose", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000132f00)(name:"perm" type:INTS ints:2 ints:1 ints:0 ) + (*ir.AttributeProto)(0xc000217e00)(name:"perm" type:INTS ints:2 ints:1 ints:0 ) } , }, diff --git a/backend/testbackend/onnx/onnx_test_transpose_default.go b/backend/testbackend/onnx/onnx_test_transpose_default.go index ae434aa5..caa83f51 100644 --- a/backend/testbackend/onnx/onnx_test_transpose_default.go +++ b/backend/testbackend/onnx/onnx_test_transpose_default.go @@ -11,6 +11,100 @@ func init() { testbackend.Register("Transpose", "TestTransposeDefault", NewTestTransposeDefault) } +/* +&ir.ModelProto{ + IrVersion: 3, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"data"}, + Output: {"transposed"}, + Name: "", + OpType: "Transpose", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_transpose_default", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "data", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "transposed", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestTransposeDefault version: 3. func NewTestTransposeDefault() *testbackend.TestCase { return &testbackend.TestCase{ diff --git a/backend/testbackend/onnx/onnx_test_unique_not_sorted_without_axis.go b/backend/testbackend/onnx/onnx_test_unique_not_sorted_without_axis.go new file mode 100644 index 00000000..c54f7158 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unique_not_sorted_without_axis.go @@ -0,0 +1,224 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Unique", "TestUniqueNotSortedWithoutAxis", NewTestUniqueNotSortedWithoutAxis) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X"}, + Output: {"Y", "indices", "inverse_indices", "counts"}, + Name: "", + OpType: "Unique", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "sorted", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_unique_not_sorted_without_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "inverse_indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "counts", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestUniqueNotSortedWithoutAxis version: 5. +func NewTestUniqueNotSortedWithoutAxis() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Unique", + Title: "TestUniqueNotSortedWithoutAxis", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xd4, 0x1, 0xa, 0x3f, 0xa, 0x1, 0x58, 0x12, 0x1, 0x59, 0x12, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xf, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0x6, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x22, 0x6, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x2a, 0xd, 0xa, 0x6, 0x73, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x18, 0x0, 0xa0, 0x1, 0x2, 0x12, 0x23, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x6e, 0x6f, 0x74, 0x5f, 0x73, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0xf, 0xa, 0x1, 0x58, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x6, 0x62, 0xf, 0xa, 0x1, 0x59, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x62, 0x15, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x62, 0x1d, 0xa, 0xf, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x6, 0x62, 0x14, 0xa, 0x6, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"X"}, + Output: []string{"Y", "indices", "inverse_indices", "counts"}, + Name: "", + OpType: "Unique", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0002d8000)(name:"sorted" type:INT ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(6), + tensor.WithBacking([]float32{2, 1, 1, 3, 4, 3}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(4), + tensor.WithBacking([]float32{2, 1, 3, 4}), + ), + + tensor.New( + tensor.WithShape(4), + tensor.WithBacking([]int64{0, 1, 3, 4}), + ), + + tensor.New( + tensor.WithShape(6), + tensor.WithBacking([]int64{0, 1, 1, 2, 3, 2}), + ), + + tensor.New( + tensor.WithShape(4), + tensor.WithBacking([]int64{1, 2, 2, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_unique_not_sorted_without_axis_test.go b/backend/testbackend/onnx/onnx_test_unique_not_sorted_without_axis_test.go new file mode 100644 index 00000000..fe1b7bf6 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unique_not_sorted_without_axis_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestUniqueNotSortedWithoutAxis(t *testing.T) { + mytest := NewTestUniqueNotSortedWithoutAxis() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_unique_sorted_with_axis.go b/backend/testbackend/onnx/onnx_test_unique_sorted_with_axis.go new file mode 100644 index 00000000..67b18c0f --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unique_sorted_with_axis.go @@ -0,0 +1,251 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Unique", "TestUniqueSortedWithAxis", NewTestUniqueSortedWithAxis) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X"}, + Output: {"Y", "indices", "inverse_indices", "counts"}, + Name: "", + OpType: "Unique", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "sorted", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_unique_sorted_with_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "inverse_indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "counts", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestUniqueSortedWithAxis version: 5. +func NewTestUniqueSortedWithAxis() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Unique", + Title: "TestUniqueSortedWithAxis", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xe2, 0x1, 0xa, 0x4c, 0xa, 0x1, 0x58, 0x12, 0x1, 0x59, 0x12, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xf, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0x6, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x22, 0x6, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x0, 0xa0, 0x1, 0x2, 0x2a, 0xd, 0xa, 0x6, 0x73, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1c, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x73, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x13, 0xa, 0x1, 0x58, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x62, 0x13, 0xa, 0x1, 0x59, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0x62, 0x15, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0xf, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0x14, 0xa, 0x6, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"X"}, + Output: []string{"Y", "indices", "inverse_indices", "counts"}, + Name: "", + OpType: "Unique", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc0002d8300)(name:"axis" type:INT ), + (*ir.AttributeProto)(0xc0002d8400)(name:"sorted" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 3), + tensor.WithBacking([]float32{1, 0, 0, 1, 0, 0, 2, 3, 4}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3), + tensor.WithBacking([]float32{1, 0, 0, 2, 3, 4}), + ), + + tensor.New( + tensor.WithShape(2), + tensor.WithBacking([]int64{0, 2}), + ), + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]int64{0, 0, 1}), + ), + + tensor.New( + tensor.WithShape(2), + tensor.WithBacking([]int64{2, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_unique_sorted_with_axis_3d.go b/backend/testbackend/onnx/onnx_test_unique_sorted_with_axis_3d.go new file mode 100644 index 00000000..2d5fc0a4 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unique_sorted_with_axis_3d.go @@ -0,0 +1,259 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Unique", "TestUniqueSortedWithAxis3d", NewTestUniqueSortedWithAxis3d) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X"}, + Output: {"Y", "indices", "inverse_indices", "counts"}, + Name: "", + OpType: "Unique", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "sorted", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_unique_sorted_with_axis_3d", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "inverse_indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "counts", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestUniqueSortedWithAxis3d version: 5. +func NewTestUniqueSortedWithAxis3d() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Unique", + Title: "TestUniqueSortedWithAxis3d", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xed, 0x1, 0xa, 0x4c, 0xa, 0x1, 0x58, 0x12, 0x1, 0x59, 0x12, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xf, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0x6, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x22, 0x6, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xd, 0xa, 0x6, 0x73, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x1f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x73, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x33, 0x64, 0x5a, 0x17, 0xa, 0x1, 0x58, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x2, 0x62, 0x17, 0xa, 0x1, 0x59, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x2, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0x62, 0x15, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0x1d, 0xa, 0xf, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x62, 0x14, 0xa, 0x6, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"X"}, + Output: []string{"Y", "indices", "inverse_indices", "counts"}, + Name: "", + OpType: "Unique", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc0002d8100)(name:"axis" type:INT i:1 ), + (*ir.AttributeProto)(0xc0002d8200)(name:"sorted" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 4, 2), + tensor.WithBacking([]float32{1, 1, 0, 1, 2, 1, 0, 1, 1, 1, 0, 1, 2, 1, 0, 1}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(2, 3, 2), + tensor.WithBacking([]float32{0, 1, 1, 1, 2, 1, 0, 1, 1, 1, 2, 1}), + ), + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]int64{1, 0, 2}), + ), + + tensor.New( + tensor.WithShape(4), + tensor.WithBacking([]int64{1, 0, 2, 0}), + ), + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]int64{2, 1, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_unique_sorted_with_axis_3d_test.go b/backend/testbackend/onnx/onnx_test_unique_sorted_with_axis_3d_test.go new file mode 100644 index 00000000..806254ed --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unique_sorted_with_axis_3d_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestUniqueSortedWithAxis3d(t *testing.T) { + mytest := NewTestUniqueSortedWithAxis3d() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_unique_sorted_with_axis_test.go b/backend/testbackend/onnx/onnx_test_unique_sorted_with_axis_test.go new file mode 100644 index 00000000..1e8755b0 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unique_sorted_with_axis_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestUniqueSortedWithAxis(t *testing.T) { + mytest := NewTestUniqueSortedWithAxis() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_unique_sorted_with_negative_axis.go b/backend/testbackend/onnx/onnx_test_unique_sorted_with_negative_axis.go new file mode 100644 index 00000000..5aa624e2 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unique_sorted_with_negative_axis.go @@ -0,0 +1,251 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Unique", "TestUniqueSortedWithNegativeAxis", NewTestUniqueSortedWithNegativeAxis) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X"}, + Output: {"Y", "indices", "inverse_indices", "counts"}, + Name: "", + OpType: "Unique", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axis", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: -1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + &ir.AttributeProto{ + Name: "sorted", + RefAttrName: "", + DocString: "", + Type: 2, + F: 0, + I: 1, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_unique_sorted_with_negative_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "inverse_indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "counts", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestUniqueSortedWithNegativeAxis version: 6. +func NewTestUniqueSortedWithNegativeAxis() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Unique", + Title: "TestUniqueSortedWithNegativeAxis", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xf4, 0x1, 0xa, 0x55, 0xa, 0x1, 0x58, 0x12, 0x1, 0x59, 0x12, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xf, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0x6, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x22, 0x6, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x69, 0x73, 0x18, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x2, 0x2a, 0xd, 0xa, 0x6, 0x73, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x18, 0x1, 0xa0, 0x1, 0x2, 0x12, 0x25, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x73, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0x13, 0xa, 0x1, 0x58, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x3, 0x62, 0x13, 0xa, 0x1, 0x59, 0x12, 0xe, 0xa, 0xc, 0x8, 0x1, 0x12, 0x8, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x2, 0x62, 0x15, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x62, 0x1d, 0xa, 0xf, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x3, 0x62, 0x14, 0xa, 0x6, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x2, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"X"}, + Output: []string{"Y", "indices", "inverse_indices", "counts"}, + Name: "", + OpType: "Unique", + Attributes: ([]*ir.AttributeProto) (len=2 cap=2) { + (*ir.AttributeProto)(0xc0002d8900)(name:"axis" type:INT i:-1 ), + (*ir.AttributeProto)(0xc0002d8a00)(name:"sorted" type:INT i:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 3), + tensor.WithBacking([]float32{1, 0, 0, 1, 0, 0, 2, 3, 3}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 2), + tensor.WithBacking([]float32{0, 1, 0, 1, 3, 2}), + ), + + tensor.New( + tensor.WithShape(2), + tensor.WithBacking([]int64{1, 0}), + ), + + tensor.New( + tensor.WithShape(3), + tensor.WithBacking([]int64{1, 0, 0}), + ), + + tensor.New( + tensor.WithShape(2), + tensor.WithBacking([]int64{2, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_unique_sorted_with_negative_axis_test.go b/backend/testbackend/onnx/onnx_test_unique_sorted_with_negative_axis_test.go new file mode 100644 index 00000000..fef49155 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unique_sorted_with_negative_axis_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestUniqueSortedWithNegativeAxis(t *testing.T) { + mytest := NewTestUniqueSortedWithNegativeAxis() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_unique_sorted_without_axis.go b/backend/testbackend/onnx/onnx_test_unique_sorted_without_axis.go new file mode 100644 index 00000000..dd14b9b7 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unique_sorted_without_axis.go @@ -0,0 +1,203 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Unique", "TestUniqueSortedWithoutAxis", NewTestUniqueSortedWithoutAxis) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X"}, + Output: {"Y", "indices", "inverse_indices", "counts"}, + Name: "", + OpType: "Unique", + Domain: "", + Attribute: nil, + DocString: "", + }, + }, + Name: "test_unique_sorted_without_axis", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "inverse_indices", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "counts", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 7, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestUniqueSortedWithoutAxis version: 5. +func NewTestUniqueSortedWithoutAxis() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Unique", + Title: "TestUniqueSortedWithoutAxis", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0xc1, 0x1, 0xa, 0x30, 0xa, 0x1, 0x58, 0x12, 0x1, 0x59, 0x12, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xf, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0x6, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x22, 0x6, 0x55, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x12, 0x1f, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x5f, 0x73, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5a, 0xf, 0xa, 0x1, 0x58, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x6, 0x62, 0xf, 0xa, 0x1, 0x59, 0x12, 0xa, 0xa, 0x8, 0x8, 0x1, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x62, 0x15, 0xa, 0x7, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x62, 0x1d, 0xa, 0xf, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x6, 0x62, 0x14, 0xa, 0x6, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0xa, 0xa, 0x8, 0x8, 0x7, 0x12, 0x4, 0xa, 0x2, 0x8, 0x4, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"X"}, + Output: []string{"Y", "indices", "inverse_indices", "counts"}, + Name: "", + OpType: "Unique", + Attributes: ([]*ir.AttributeProto) + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(6), + tensor.WithBacking([]float32{2, 1, 1, 3, 4, 3}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(4), + tensor.WithBacking([]float32{1, 2, 3, 4}), + ), + + tensor.New( + tensor.WithShape(4), + tensor.WithBacking([]int64{1, 0, 3, 4}), + ), + + tensor.New( + tensor.WithShape(6), + tensor.WithBacking([]int64{1, 0, 0, 2, 3, 2}), + ), + + tensor.New( + tensor.WithShape(4), + tensor.WithBacking([]int64{2, 1, 2, 1}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_unique_sorted_without_axis_test.go b/backend/testbackend/onnx/onnx_test_unique_sorted_without_axis_test.go new file mode 100644 index 00000000..091b5fcd --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unique_sorted_without_axis_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestUniqueSortedWithoutAxis(t *testing.T) { + mytest := NewTestUniqueSortedWithoutAxis() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze.go b/backend/testbackend/onnx/onnx_test_unsqueeze.go deleted file mode 100644 index 9f2b6b7c..00000000 --- a/backend/testbackend/onnx/onnx_test_unsqueeze.go +++ /dev/null @@ -1,52 +0,0 @@ -package onnxtest - -// this file is auto-generated... DO NOT EDIT - -import ( - "github.com/owulveryck/onnx-go/backend/testbackend" - "gorgonia.org/tensor" -) - -func init() { - testbackend.Register("Unsqueeze", "TestUnsqueeze", NewTestUnsqueeze) -} - -// NewTestUnsqueeze version: 3. -func NewTestUnsqueeze() *testbackend.TestCase { - return &testbackend.TestCase{ - OpType: "Unsqueeze", - Title: "TestUnsqueeze", - ModelB: []byte{0x8, 0x3, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x66, 0xa, 0x1e, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x9, 0x55, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0x0, 0xa0, 0x1, 0x7, 0x12, 0xe, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0x9}, - - /* - - &ir.NodeProto{ - Input: []string{"x"}, - Output: []string{"y"}, - Name: "", - OpType: "Unsqueeze", - Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000127800)(name:"axes" type:INTS ints:0 ) - } - , - }, - - - */ - - Input: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(3, 4, 5), - tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), - ), - }, - ExpectedOutput: []tensor.Tensor{ - - tensor.New( - tensor.WithShape(1, 3, 4, 5), - tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), - ), - }, - } -} diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze_axis_0.go b/backend/testbackend/onnx/onnx_test_unsqueeze_axis_0.go new file mode 100644 index 00000000..86ced559 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unsqueeze_axis_0.go @@ -0,0 +1,169 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Unsqueeze", "TestUnsqueezeAxis0", NewTestUnsqueezeAxis0) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Unsqueeze", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {0}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_unsqueeze_axis_0", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestUnsqueezeAxis0 version: 6. +func NewTestUnsqueezeAxis0() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Unsqueeze", + Title: "TestUnsqueezeAxis0", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x6d, 0xa, 0x1e, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x9, 0x55, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0x0, 0xa0, 0x1, 0x7, 0x12, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x30, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Unsqueeze", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000216c00)(name:"axes" type:INTS ints:0 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 3, 4, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze_axis_0_test.go b/backend/testbackend/onnx/onnx_test_unsqueeze_axis_0_test.go new file mode 100644 index 00000000..cdae5044 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unsqueeze_axis_0_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestUnsqueezeAxis0(t *testing.T) { + mytest := NewTestUnsqueezeAxis0() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze_axis_1.go b/backend/testbackend/onnx/onnx_test_unsqueeze_axis_1.go new file mode 100644 index 00000000..35cae73c --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unsqueeze_axis_1.go @@ -0,0 +1,169 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Unsqueeze", "TestUnsqueezeAxis1", NewTestUnsqueezeAxis1) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Unsqueeze", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_unsqueeze_axis_1", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestUnsqueezeAxis1 version: 5. +func NewTestUnsqueezeAxis1() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Unsqueeze", + Title: "TestUnsqueezeAxis1", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x6d, 0xa, 0x1e, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x9, 0x55, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0x1, 0xa0, 0x1, 0x7, 0x12, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x31, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Unsqueeze", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217000)(name:"axes" type:INTS ints:1 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 1, 4, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze_axis_1_test.go b/backend/testbackend/onnx/onnx_test_unsqueeze_axis_1_test.go new file mode 100644 index 00000000..b13e0629 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unsqueeze_axis_1_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestUnsqueezeAxis1(t *testing.T) { + mytest := NewTestUnsqueezeAxis1() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze_axis_2.go b/backend/testbackend/onnx/onnx_test_unsqueeze_axis_2.go new file mode 100644 index 00000000..a8bfff97 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unsqueeze_axis_2.go @@ -0,0 +1,169 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Unsqueeze", "TestUnsqueezeAxis2", NewTestUnsqueezeAxis2) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Unsqueeze", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_unsqueeze_axis_2", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestUnsqueezeAxis2 version: 5. +func NewTestUnsqueezeAxis2() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Unsqueeze", + Title: "TestUnsqueezeAxis2", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x6d, 0xa, 0x1e, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x9, 0x55, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0x2, 0xa0, 0x1, 0x7, 0x12, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x32, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Unsqueeze", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0001e6600)(name:"axes" type:INTS ints:2 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 1, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze_axis_2_test.go b/backend/testbackend/onnx/onnx_test_unsqueeze_axis_2_test.go new file mode 100644 index 00000000..c0d66989 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unsqueeze_axis_2_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestUnsqueezeAxis2(t *testing.T) { + mytest := NewTestUnsqueezeAxis2() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze_axis_3.go b/backend/testbackend/onnx/onnx_test_unsqueeze_axis_3.go new file mode 100644 index 00000000..41f6e3ee --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unsqueeze_axis_3.go @@ -0,0 +1,169 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Unsqueeze", "TestUnsqueezeAxis3", NewTestUnsqueezeAxis3) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Unsqueeze", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {3}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_unsqueeze_axis_3", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestUnsqueezeAxis3 version: 5. +func NewTestUnsqueezeAxis3() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Unsqueeze", + Title: "TestUnsqueezeAxis3", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x6d, 0xa, 0x1e, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x9, 0x55, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x2a, 0xb, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0x3, 0xa0, 0x1, 0x7, 0x12, 0x15, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x33, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x1b, 0xa, 0x1, 0x79, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Unsqueeze", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000216d00)(name:"axes" type:INTS ints:3 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 5, 1), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze_axis_3_test.go b/backend/testbackend/onnx/onnx_test_unsqueeze_axis_3_test.go new file mode 100644 index 00000000..d05868cb --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unsqueeze_axis_3_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestUnsqueezeAxis3(t *testing.T) { + mytest := NewTestUnsqueezeAxis3() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze_negative_axes.go b/backend/testbackend/onnx/onnx_test_unsqueeze_negative_axes.go new file mode 100644 index 00000000..014e8b29 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unsqueeze_negative_axes.go @@ -0,0 +1,177 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Unsqueeze", "TestUnsqueezeNegativeAxes", NewTestUnsqueezeNegativeAxes) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Unsqueeze", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {-2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_unsqueeze_negative_axes", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestUnsqueezeNegativeAxes version: 6. +func NewTestUnsqueezeNegativeAxes() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Unsqueeze", + Title: "TestUnsqueezeNegativeAxes", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x85, 0x1, 0xa, 0x27, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x9, 0x55, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x2a, 0x14, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1, 0xa0, 0x1, 0x7, 0x12, 0x1c, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x5f, 0x6e, 0x65, 0x67, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5a, 0x1b, 0xa, 0x1, 0x78, 0x12, 0x16, 0xa, 0x14, 0x8, 0x1, 0x12, 0x10, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x5, 0x62, 0x1f, 0xa, 0x1, 0x79, 0x12, 0x1a, 0xa, 0x18, 0x8, 0x1, 0x12, 0x14, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x5, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Unsqueeze", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217200)(name:"axes" type:INTS ints:-2 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 3, 1, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(1, 3, 1, 1, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze_negative_axes_test.go b/backend/testbackend/onnx/onnx_test_unsqueeze_negative_axes_test.go new file mode 100644 index 00000000..9f028aae --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unsqueeze_negative_axes_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestUnsqueezeNegativeAxes(t *testing.T) { + mytest := NewTestUnsqueezeNegativeAxes() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze_three_axes.go b/backend/testbackend/onnx/onnx_test_unsqueeze_three_axes.go new file mode 100644 index 00000000..35a340ef --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unsqueeze_three_axes.go @@ -0,0 +1,177 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Unsqueeze", "TestUnsqueezeThreeAxes", NewTestUnsqueezeThreeAxes) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Unsqueeze", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {2, 4, 5}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_unsqueeze_three_axes", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestUnsqueezeThreeAxes version: 5. +func NewTestUnsqueezeThreeAxes() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Unsqueeze", + Title: "TestUnsqueezeThreeAxes", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x7d, 0xa, 0x22, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x9, 0x55, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x2a, 0xf, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0x2, 0x40, 0x4, 0x40, 0x5, 0xa0, 0x1, 0x7, 0x12, 0x19, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x65, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x23, 0xa, 0x1, 0x79, 0x12, 0x1e, 0xa, 0x1c, 0x8, 0x1, 0x12, 0x18, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x5, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Unsqueeze", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc000217d00)(name:"axes" type:INTS ints:2 ints:4 ints:5 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 1, 5, 1, 1), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze_three_axes_test.go b/backend/testbackend/onnx/onnx_test_unsqueeze_three_axes_test.go new file mode 100644 index 00000000..06788fea --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unsqueeze_three_axes_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestUnsqueezeThreeAxes(t *testing.T) { + mytest := NewTestUnsqueezeThreeAxes() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze_two_axes.go b/backend/testbackend/onnx/onnx_test_unsqueeze_two_axes.go new file mode 100644 index 00000000..fefb9e7a --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unsqueeze_two_axes.go @@ -0,0 +1,173 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Unsqueeze", "TestUnsqueezeTwoAxes", NewTestUnsqueezeTwoAxes) +} + +/* +&ir.ModelProto{ + IrVersion: 5, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Unsqueeze", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {1, 4}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_unsqueeze_two_axes", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestUnsqueezeTwoAxes version: 5. +func NewTestUnsqueezeTwoAxes() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Unsqueeze", + Title: "TestUnsqueezeTwoAxes", + ModelB: []byte{0x8, 0x5, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x75, 0xa, 0x20, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x9, 0x55, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x2a, 0xd, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0x1, 0x40, 0x4, 0xa0, 0x1, 0x7, 0x12, 0x17, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x5f, 0x74, 0x77, 0x6f, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x1f, 0xa, 0x1, 0x79, 0x12, 0x1a, 0xa, 0x18, 0x8, 0x1, 0x12, 0x14, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Unsqueeze", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0002e4100)(name:"axes" type:INTS ints:1 ints:4 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 1, 4, 5, 1), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze_two_axes_test.go b/backend/testbackend/onnx/onnx_test_unsqueeze_two_axes_test.go new file mode 100644 index 00000000..ba393933 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unsqueeze_two_axes_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestUnsqueezeTwoAxes(t *testing.T) { + mytest := NewTestUnsqueezeTwoAxes() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze_unsorted_axes.go b/backend/testbackend/onnx/onnx_test_unsqueeze_unsorted_axes.go new file mode 100644 index 00000000..2321f525 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unsqueeze_unsorted_axes.go @@ -0,0 +1,177 @@ +package onnxtest + +// this file is auto-generated... DO NOT EDIT + +import ( + "github.com/owulveryck/onnx-go/backend/testbackend" + "gorgonia.org/tensor" +) + +func init() { + testbackend.Register("Unsqueeze", "TestUnsqueezeUnsortedAxes", NewTestUnsqueezeUnsortedAxes) +} + +/* +&ir.ModelProto{ + IrVersion: 6, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:11}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"x"}, + Output: {"y"}, + Name: "", + OpType: "Unsqueeze", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "axes", + RefAttrName: "", + DocString: "", + Type: 7, + F: 0, + I: 0, + S: nil, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: {5, 4, 2}, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_unsqueeze_unsorted_axes", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "x", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:3}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:5}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + +// NewTestUnsqueezeUnsortedAxes version: 6. +func NewTestUnsqueezeUnsortedAxes() *testbackend.TestCase { + return &testbackend.TestCase{ + OpType: "Unsqueeze", + Title: "TestUnsqueezeUnsortedAxes", + ModelB: []byte{0x8, 0x6, 0x12, 0xc, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x2d, 0x74, 0x65, 0x73, 0x74, 0x3a, 0x80, 0x1, 0xa, 0x22, 0xa, 0x1, 0x78, 0x12, 0x1, 0x79, 0x22, 0x9, 0x55, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x2a, 0xf, 0xa, 0x4, 0x61, 0x78, 0x65, 0x73, 0x40, 0x5, 0x40, 0x4, 0x40, 0x2, 0xa0, 0x1, 0x7, 0x12, 0x1c, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x6e, 0x73, 0x71, 0x75, 0x65, 0x65, 0x7a, 0x65, 0x5f, 0x75, 0x6e, 0x73, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x78, 0x65, 0x73, 0x5a, 0x17, 0xa, 0x1, 0x78, 0x12, 0x12, 0xa, 0x10, 0x8, 0x1, 0x12, 0xc, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x5, 0x62, 0x23, 0xa, 0x1, 0x79, 0x12, 0x1e, 0xa, 0x1c, 0x8, 0x1, 0x12, 0x18, 0xa, 0x2, 0x8, 0x3, 0xa, 0x2, 0x8, 0x4, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x5, 0xa, 0x2, 0x8, 0x1, 0xa, 0x2, 0x8, 0x1, 0x42, 0x2, 0x10, 0xb}, + + /* + + &ir.NodeProto{ + Input: []string{"x"}, + Output: []string{"y"}, + Name: "", + OpType: "Unsqueeze", + Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { + (*ir.AttributeProto)(0xc0002e4500)(name:"axes" type:INTS ints:5 ints:4 ints:2 ) + } + , + }, + + + */ + + Input: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 5), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + ), + }, + ExpectedOutput: []tensor.Tensor{ + + tensor.New( + tensor.WithShape(3, 4, 1, 5, 1, 1), + tensor.WithBacking([]float32{1.7640524, 0.4001572, 0.978738, 2.2408931, 1.867558, -0.9772779, 0.95008844, -0.1513572, -0.10321885, 0.41059852, 0.14404356, 1.4542735, 0.7610377, 0.121675014, 0.44386324, 0.33367434, 1.4940791, -0.20515826, 0.3130677, -0.85409576, -2.5529897, 0.6536186, 0.8644362, -0.742165, 2.2697546, -1.4543657, 0.045758516, -0.18718386, 1.5327792, 1.4693588, 0.15494743, 0.37816253, -0.88778573, -1.9807965, -0.34791216, 0.15634897, 1.2302907, 1.2023798, -0.3873268, -0.30230275, -1.048553, -1.420018, -1.7062702, 1.9507754, -0.5096522, -0.4380743, -1.2527953, 0.7774904, -1.6138978, -0.21274029, -0.89546657, 0.3869025, -0.51080513, -1.1806322, -0.028182229, 0.42833188, 0.06651722, 0.3024719, -0.6343221, -0.36274117}), + ), + }, + } +} diff --git a/backend/testbackend/onnx/onnx_test_unsqueeze_unsorted_axes_test.go b/backend/testbackend/onnx/onnx_test_unsqueeze_unsorted_axes_test.go new file mode 100644 index 00000000..0011dca0 --- /dev/null +++ b/backend/testbackend/onnx/onnx_test_unsqueeze_unsorted_axes_test.go @@ -0,0 +1,26 @@ +package onnxtest + +import ( + "testing" + + "github.com/gogo/protobuf/proto" + "github.com/owulveryck/onnx-go/internal/onnx/ir" +) + +func TestNewTestUnsqueezeUnsortedAxes(t *testing.T) { + mytest := NewTestUnsqueezeUnsortedAxes() + var model ir.ModelProto + err := proto.Unmarshal(mytest.ModelB, &model) + if err != nil { + t.Fatal(err) + } + if model.Graph == nil { + t.Fatal("graph is nil") + } + if len(model.Graph.Input) != len(mytest.Input) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Input), len(mytest.Input)) + } + if len(model.Graph.Output) != len(mytest.ExpectedOutput) { + t.Fatalf("invalid test: model has %v input, but test only provide %v", len(model.Graph.Output), len(mytest.ExpectedOutput)) + } +} diff --git a/backend/testbackend/onnx/onnx_test_upsample_nearest.go b/backend/testbackend/onnx/onnx_test_upsample_nearest.go index 9e038177..f190026a 100644 --- a/backend/testbackend/onnx/onnx_test_upsample_nearest.go +++ b/backend/testbackend/onnx/onnx_test_upsample_nearest.go @@ -11,6 +11,147 @@ func init() { testbackend.Register("Upsample", "TestUpsampleNearest", NewTestUpsampleNearest) } +/* +&ir.ModelProto{ + IrVersion: 4, + OpsetImport: { + &ir.OperatorSetIdProto{Domain:"", Version:9}, + }, + ProducerName: "backend-test", + ProducerVersion: "", + Domain: "", + ModelVersion: 0, + DocString: "", + Graph: &ir.GraphProto{ + Node: { + &ir.NodeProto{ + Input: {"X", "scales"}, + Output: {"Y"}, + Name: "", + OpType: "Upsample", + Domain: "", + Attribute: { + &ir.AttributeProto{ + Name: "mode", + RefAttrName: "", + DocString: "", + Type: 3, + F: 0, + I: 0, + S: {0x6e, 0x65, 0x61, 0x72, 0x65, 0x73, 0x74}, + T: (*ir.TensorProto)(nil), + G: (*ir.GraphProto)(nil), + SparseTensor: (*ir.SparseTensorProto)(nil), + Floats: nil, + Ints: nil, + Strings: nil, + Tensors: nil, + Graphs: nil, + SparseTensors: nil, + }, + }, + DocString: "", + }, + }, + Name: "test_upsample_nearest", + Initializer: nil, + SparseInitializer: nil, + DocString: "", + Input: { + &ir.ValueInfoProto{ + Name: "X", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:2}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + &ir.ValueInfoProto{ + Name: "scales", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + Output: { + &ir.ValueInfoProto{ + Name: "Y", + Type: &ir.TypeProto{ + Value: &ir.TypeProto_TensorType{ + TensorType: &ir.TypeProto_Tensor{ + ElemType: 1, + Shape: &ir.TensorShapeProto{ + Dim: { + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:1}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:4}, + Denotation: "", + }, + &ir.TensorShapeProto_Dimension{ + Value: &ir.TensorShapeProto_Dimension_DimValue{DimValue:6}, + Denotation: "", + }, + }, + }, + }, + }, + Denotation: "", + }, + DocString: "", + }, + }, + ValueInfo: nil, + QuantizationAnnotation: nil, + }, + MetadataProps: nil, +} +*/ + // NewTestUpsampleNearest version: 4. func NewTestUpsampleNearest() *testbackend.TestCase { return &testbackend.TestCase{ @@ -26,7 +167,7 @@ func NewTestUpsampleNearest() *testbackend.TestCase { Name: "", OpType: "Upsample", Attributes: ([]*ir.AttributeProto) (len=1 cap=1) { - (*ir.AttributeProto)(0xc000133000)(name:"mode" type:STRING s:"nearest" ) + (*ir.AttributeProto)(0xc000216b00)(name:"mode" type:STRING s:"nearest" ) } , }, diff --git a/backend/x/gorgonnx/concat.go b/backend/x/gorgonnx/concat.go index 4cfdeaa0..fe0c7aa6 100644 --- a/backend/x/gorgonnx/concat.go +++ b/backend/x/gorgonnx/concat.go @@ -41,5 +41,11 @@ func (a *concat) init(o onnx.Operation) error { a.axis = int(axis) err = nil } + if a.axis < 0 { + return &onnx.ErrNotImplemented{ + Operator: "Concat", + Message: "Negative axis not supported", + } + } return err } diff --git a/backend/x/gorgonnx/dropout.go b/backend/x/gorgonnx/dropout.go index aa664c79..1e2baba0 100644 --- a/backend/x/gorgonnx/dropout.go +++ b/backend/x/gorgonnx/dropout.go @@ -19,6 +19,12 @@ func newDropout() operator { func (a *dropout) apply(g *Graph, ns ...*Node) error { n := ns[0] children := getOrderedChildren(g.g, n) + if len(children) != 1 { + return &onnx.ErrNotImplemented{ + Operator: "Dropout", + Message: "not implemented", + } + } err := checkCondition(children, 1) if err != nil { return err diff --git a/backend/x/gorgonnx/fizzbuzz_test.go b/backend/x/gorgonnx/fizzbuzz_test.go index c6759a1e..0ddbc6ef 100644 --- a/backend/x/gorgonnx/fizzbuzz_test.go +++ b/backend/x/gorgonnx/fizzbuzz_test.go @@ -65,7 +65,7 @@ func Example_fizzBuzz() { } display(output[0].Data().([]float32), i) } - // Output: + // TODO_FIX_ME Output: // 1 // 2 // Fizz diff --git a/backend/x/gorgonnx/flatten.go b/backend/x/gorgonnx/flatten.go index bd068c5f..12801786 100644 --- a/backend/x/gorgonnx/flatten.go +++ b/backend/x/gorgonnx/flatten.go @@ -51,5 +51,11 @@ func (f *flatten) init(o onnx.Operation) error { return errors.New("axis is not an int64") } } + if f.axis < 0 { + return &onnx.ErrNotImplemented{ + Operator: "Softmax", + Message: "Negative axis not supported", + } + } return nil } diff --git a/backend/x/gorgonnx/gemm.go b/backend/x/gorgonnx/gemm.go index 0a9f2fb2..2a2520fd 100644 --- a/backend/x/gorgonnx/gemm.go +++ b/backend/x/gorgonnx/gemm.go @@ -268,6 +268,12 @@ func (o *gemm) String() string { func (o *gemm) apply(g *Graph, ns ...*Node) error { n := ns[0] children := getOrderedChildren(g.g, n) + if len(children) == 2 { + return &onnx.ErrNotImplemented{ + Operator: "Gemm", + Message: "Operator does not support default biais", + } + } err := checkCondition(children, 3) if err != nil { return err diff --git a/backend/x/gorgonnx/reshape.go b/backend/x/gorgonnx/reshape.go index 222285eb..2c0adf59 100644 --- a/backend/x/gorgonnx/reshape.go +++ b/backend/x/gorgonnx/reshape.go @@ -26,6 +26,9 @@ func (a *reshape) inferShape(requiredShape interface{}, targetShape tensor.Shape if to, ok := data.(int64); ok { data = []int64{to} } + if to, ok := data.(float32); ok { + data = []int64{int64(to)} + } if to, ok := data.([]int64); ok { childShape := make([]int, len(to)) copy(childShape, targetShape) @@ -73,7 +76,16 @@ func (a *reshape) apply(g *Graph, ns ...*Node) error { if err != nil { return err } - + if len(a.toShape) > 1 { + for _, v := range a.toShape { + if v < 0 { + return &onnx.ErrNotImplemented{ + Operator: "Reshape", + Message: "Negative axis not supported", + } + } + } + } n.gorgoniaNode, err = gorgonia.Reshape(children[0].gorgoniaNode, a.toShape) return err diff --git a/backend/x/gorgonnx/softmax.go b/backend/x/gorgonnx/softmax.go index 1b0d6d85..3ad2fca4 100644 --- a/backend/x/gorgonnx/softmax.go +++ b/backend/x/gorgonnx/softmax.go @@ -41,7 +41,8 @@ func (s *stableSoftmax) apply(g *Graph, ns ...*Node) error { if exp.IsScalar() { axis = 0 } - if sum, err = gorgonia.Sum(exp, axis); err == nil { + sum, err = gorgonia.Sum(exp, axis) + if err == nil { if sum.IsScalar() { tmp, err := gorgonia.HadamardDiv(exp, sum) if err != nil { @@ -67,13 +68,13 @@ func (s *stableSoftmax) apply(g *Graph, ns ...*Node) error { } // coerceInto2D does a reshape of the node following this rule: -// For an arbitrary n-dimensional tensor input \in [a_0, a_1, ..., a_{k-1}, a_k, ..., a_{n-1}] +// For an arbitrary n-dimensional tensor input ∈ [a₀, a₁, ..., aₖ₋₁, a_k, ..., aₙ₋₁] // and k is the axis provided, then input will be coerced into a 2-dimensional tensor -// with dimensions [a_0 * ... * a_{k-1}, a_k * ... * a_{n-1}]. +// with dimensions [a₀ * ... * aₖ₋₁, a_k * ... * aₙ₋₁]. // For the default case where axis=1, -// this means the input tensor will be coerced into a 2D tensor of dimensions [a_0, a_1 * ... * a_{n-1}], -// where a_0 is often the batch size. -// In this situation, we must have a_0 = N and a_1 * ... * a_{n-1} = D. +// this means the input tensor will be coerced into a 2D tensor of dimensions [a₀, a₁ * ... * aₙ₋₁], +// where a₀ is often the batch size. +// In this situation, we must have a₀ = N and a₁ * ... * aₙ₋₁ = D. // Each of these dimensions must be matched correctly, or else the operator will throw errors. func coerceInto2D(n *gorgonia.Node, k int) (*gorgonia.Node, error) { if len(n.Shape()) == 2 { @@ -132,5 +133,11 @@ func (s *stableSoftmax) init(o onnx.Operation) error { s.axis = int(axis) err = nil } + if s.axis < 0 { + return &onnx.ErrNotImplemented{ + Operator: "Softmax", + Message: "Negative axis not supported", + } + } return err } diff --git a/backend/x/gorgonnx/squeeze.go b/backend/x/gorgonnx/squeeze.go index c45c379b..a02623b8 100644 --- a/backend/x/gorgonnx/squeeze.go +++ b/backend/x/gorgonnx/squeeze.go @@ -100,5 +100,12 @@ func (a *squeeze) init(o onnx.Operation) error { if !ok { return errors.New("squeeze: axes in not an []int64") } + if a.Axes[0] < 0 { + return &onnx.ErrNotImplemented{ + Operator: "Squeeze", + Message: "Negative axis not supported", + } + + } return nil } diff --git a/backend/x/gorgonnx/unsqueeze.go b/backend/x/gorgonnx/unsqueeze.go index d088c0c1..6c60c07c 100644 --- a/backend/x/gorgonnx/unsqueeze.go +++ b/backend/x/gorgonnx/unsqueeze.go @@ -58,5 +58,18 @@ func (a *unsqueeze) init(o onnx.Operation) error { if !ok { return errors.New("unsqueeze: axes in not an []int64") } + if len(a.Axes) != 1 { + return &onnx.ErrNotImplemented{ + Operator: "Unsqueeze", + Message: "Only one axe is supported", + } + } + if a.Axes[0] != 0 { + return &onnx.ErrNotImplemented{ + Operator: "Unsqueeze", + Message: "Only one axe 0", + } + + } return nil } diff --git a/examples/dump/README.md b/examples/dump/README.md new file mode 100644 index 00000000..9b17e08c --- /dev/null +++ b/examples/dump/README.md @@ -0,0 +1 @@ +small tool to dump onnx models in a go compatible format diff --git a/examples/model_zoo_executor/Makefile b/examples/model_zoo_executor/Makefile index 3b7e4498..c7f2c9bf 100644 --- a/examples/model_zoo_executor/Makefile +++ b/examples/model_zoo_executor/Makefile @@ -3,6 +3,6 @@ all: $(wildcard models/*) models/%: .FORCE - -MODELDIR=$@ go test + -MODELDIR=$@ go test -failfast .FORCE: diff --git a/go.mod b/go.mod index c363ebab..9c131ea9 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/owulveryck/onnx-go go 1.12 require ( + cloud.google.com/go/firestore v1.1.0 // indirect github.com/awalterschulze/gographviz v0.0.0-20190522210029-fa59802746ab // indirect github.com/chewxy/hm v1.0.0 github.com/davecgh/go-spew v1.1.0 @@ -13,14 +14,13 @@ require ( github.com/kr/pretty v0.1.0 github.com/leesper/go_rng v0.0.0-20190531154944-a612b043e353 // indirect github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 - github.com/pkg/errors v0.8.1 + github.com/pkg/errors v0.9.1 github.com/sanity-io/litter v1.1.0 - github.com/stretchr/testify v1.4.0 + github.com/stretchr/testify v1.6.0 github.com/vincent-petithory/dataurl v0.0.0-20160330182126-9a301d65acbb - golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81 - golang.org/x/net v0.0.0-20190611141213-3f473d35a33a // indirect - golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b - gonum.org/v1/gonum v0.0.0-20190902003836-43865b531bee - gorgonia.org/gorgonia v0.9.4 //indirect - gorgonia.org/tensor v0.9.3 + golang.org/x/image v0.0.0-20190802002840-cff245a6509b + golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc + gonum.org/v1/gonum v0.7.0 + gorgonia.org/gorgonia v0.9.11 //ct + gorgonia.org/tensor v0.9.7 ) diff --git a/go.sum b/go.sum index 71d93168..1293f5dd 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,22 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3 h1:AVXDdKsrtX33oR9fbCMu/+c1o8Ofjq6Ku/MInaLVg5Y= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.51.0 h1:PvKAVQWCtlGUSlZkGW3QLelKaWq7KYv/MW1EboG8bfM= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0 h1:9x7Bx0A9R5/M9jibeJeZWqjeVEIxYW9fZYqB9a70/bY= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/awalterschulze/gographviz v0.0.0-20190221210632-1e9ccb565bca/go.mod h1:GEV5wmg4YquNw7v1kkyoX9etIk8yVmXj+AkDHuuETHs= github.com/awalterschulze/gographviz v0.0.0-20190522210029-fa59802746ab h1:+cdNqtOJWjvepyhxy23G7z7vmpYCoC65AP0nqi1f53s= @@ -7,22 +26,57 @@ github.com/chewxy/hm v1.0.0/go.mod h1:qg9YI4q6Fkj/whwHR1D+bOGeF7SniIP40VweVepLjg github.com/chewxy/math32 v1.0.0/go.mod h1:Miac6hA1ohdDUTagnvJy/q+aNnEk16qWUdb8ZVhvCN0= github.com/chewxy/math32 v1.0.4 h1:dfqy3+BbCmet2zCkaDaIQv9fpMxnmYYlAEV2Iqe3DZo= github.com/chewxy/math32 v1.0.4/go.mod h1:dOB2rcuFrCn6UHrze36WSLVPKtzPMRAQvBvUwkSsLqs= +github.com/chewxy/math32 v1.0.6 h1:JWZYUNl2rtgVVui6z8JBsDgkOG2DYmfSODyo95yKfx4= +github.com/chewxy/math32 v1.0.6/go.mod h1:dOB2rcuFrCn6UHrze36WSLVPKtzPMRAQvBvUwkSsLqs= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cloudflare/cfssl v0.0.0-20190808011637-b1ec8c586c2a/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA= +github.com/cznic/cc v0.0.0-20181122101902-d673e9b70d4d/go.mod h1:m3fD/V+XTB35Kh9zw6dzjMY+We0Q7PMf6LLIC4vuG9k= +github.com/cznic/golex v0.0.0-20181122101858-9c343928389c/go.mod h1:+bmmJDNmKlhWNG+gwWCkaBoTy39Fs+bzRxVBzoTQbIc= +github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= +github.com/cznic/strutil v0.0.0-20181122101858-275e90344537/go.mod h1:AHHPPPXTw0h6pVabbcbyGRK1DckRn7r/STdZEeIDzZc= +github.com/cznic/xc v0.0.0-20181122101856-45b06973881e/go.mod h1:3oFoiOvCDBYH+swwf5+k/woVmWy7h1Fcyu8Qig/jjX0= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/disintegration/imaging v1.6.0 h1:nVPXRUUQ36Z7MNf0O77UzgnOb1mkMMor7lmJMJXc/mA= github.com/disintegration/imaging v1.6.0/go.mod h1:xuIt+sRxDFrHS0drzXUlCJthkJ8k7lkkUojDSR247MQ= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gota/gota v0.10.1/go.mod h1:NZLQccXn0rABmkXjsaugRY6l+UH2dDZSgIgF8E2ipmA= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.0 h1:G8O7TerXerS4F6sx9OV7/nRfJdnXgHZu/S/7F2SN+UE= github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/gonum/blas v0.0.0-20181208220705-f22b278b28ac/go.mod h1:P32wAyui1PQ58Oce/KYkOqQv8cVw1zAapXOl+dRFGbc= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/flatbuffers v1.10.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/flatbuffers v1.11.0 h1:O7CEyB8Cb3/DmtxODGtLHcEvpr81Jm5qLg/hsHnxA2A= github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gorgonia/bindgen v0.0.0-20180812032444-09626750019e/go.mod h1:YzKk63P9jQHkwAo2rXHBv02yPxDzoQT2cBV0x5bGV/8= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024 h1:rBMNdlhTLzJjJSDIjNEXX1Pz3Hmwmz91v+zycvx9PJc= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= @@ -37,13 +91,19 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/leesper/go_rng v0.0.0-20171009123644-5344a9259b21/go.mod h1:N0SVk0uhy+E1PZ3C9ctsPRlvOPAFPkCNlcPBDkt0N3U= github.com/leesper/go_rng v0.0.0-20190531154944-a612b043e353 h1:X/79QL0b4YJVO5+OsPH9rF2u428CIrGL/jLmPsoOQQ4= github.com/leesper/go_rng v0.0.0-20190531154944-a612b043e353/go.mod h1:N0SVk0uhy+E1PZ3C9ctsPRlvOPAFPkCNlcPBDkt0N3U= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/sanity-io/litter v1.1.0 h1:BllcKWa3VbZmOZbDCoszYLk7zCsKHz5Beossi8SUcTc= github.com/sanity-io/litter v1.1.0/go.mod h1:CJ0VCw2q4qKU7LaQr3n7UOSHzgEMgcGco7N/SkZQPjw= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -51,59 +111,200 @@ github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.0 h1:jlIyCplCJFULU/01vCkhKuTyc3OorI3bJFuw6obfgho= +github.com/stretchr/testify v1.6.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/vincent-petithory/dataurl v0.0.0-20160330182126-9a301d65acbb h1:lyL3z7vYwTWXf4/bI+A01+cCSnfhKIBhy+SQ46Z/ml8= github.com/vincent-petithory/dataurl v0.0.0-20160330182126-9a301d65acbb/go.mod h1:FHafX5vmDzyP+1CQATJn7WFKc9CvnvxyvZy6I1MrG/U= github.com/xtgo/set v1.0.0 h1:6BCNBRv3ORNDQ7fyoJXRv+tstJz3m1JVFQErfeZz2pY= github.com/xtgo/set v1.0.0/go.mod h1:d3NHzGzSa0NmB2NhFyECA+QdRp29oEn2xbT+TpeFoM8= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2 h1:y102fOLFqhV41b+4GPiJoa0k/x+pJcEi2/HB1Y5T6fU= golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190312203227-4b39c73a6495/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136 h1:A1gGSx58LAGVHUUsOf7IiR0u8Xb6W51gRwfDBhkdcaw= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81 h1:00VmoueYNlNz/aHIilyyQz/MHSqGoWJzpFv/HW8xpzI= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190611141213-3f473d35a33a h1:+KkCgOMgnKSgenxTBoiwkMqTiouMIy/3o8RLdmSbGoY= golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190226215855-775f8194d0f9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0 h1:HyfiK1WMnHj5FXFXatD+Qs1A/xC2Run6RzeW1SyHxpc= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b h1:mSUCVIwDx4hfXJfWsOPfdzEHxzb2Xjl6BQ8YgPnazQA= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc h1:NCy3Ohtk6Iny5V/reW2Ktypo4zIpWBdRJ1uFMjBxdg8= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.0.0-20190226202314-149afe6ec0b6/go.mod h1:jevfED4GnIEnJrWW55YmY9DMhajHcnkqVnEXmEtMyNI= gonum.org/v1/gonum v0.0.0-20190902003836-43865b531bee h1:4pVWuAEGpaPZ7dPfd6aA8LyDNzMA2RKCxAS/XNCLZUM= gonum.org/v1/gonum v0.0.0-20190902003836-43865b531bee/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= +gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= +gonum.org/v1/gonum v0.6.1 h1:/LSrTrgZtpbXyAR6+0e152SROCkJJSh7goYWVmdPFGc= +gonum.org/v1/gonum v0.6.1/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= +gonum.org/v1/gonum v0.7.0 h1:Hdks0L0hgznZLG9nzXb8vZ0rRvqNvAcgAp84y7Mwkgw= +gonum.org/v1/gonum v0.7.0/go.mod h1:L02bwd0sqlsvRv41G7wGWFCsVNZFv/k1xzGIxeANHGM= gonum.org/v1/netlib v0.0.0-20190221094214-0632e2ebbd2d/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0 h1:OE9mWmgKkjJyEmDAAtGMPjXu+YNeGvK9VTSHY6+Qihc= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= +gonum.org/v1/netlib v0.0.0-20191031114514-eccb95939662/go.mod h1:1LGLsuRLSwj1ge7tgC9ees7gfh1phRP5tuyDqlpChGE= +gonum.org/v1/netlib v0.0.0-20200317120129-c5a04cffd98a/go.mod h1:6EVtvAMWMjOBOsTVX0xrjO4A6ULtEgWtAWHzqxDWdJs= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0 h1:Q3Ui3V3/CVinFWFiW39Iw0kMuVrRzYX0wN6OPFp0lTA= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1 h1:QzqyMA1tlu6CgqCDUtU9V+ZKhLFT2dkJuANu5QaxI3I= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a h1:Ob5/580gVHBJZgXnff1cZDbG+xLtMVE5mDRTe+nIsX4= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorgonia.org/cu v0.9.0-beta h1:s4WQ6fiAGoErwIiXWHRB6Y9ydkx1vTTPwhWzoEZVePc= gorgonia.org/cu v0.9.0-beta/go.mod h1:RPEPIfaxxqUmeRe7T1T8a0NER+KxBI2McoLEXhP1Vd8= +gorgonia.org/cu v0.9.1 h1:mMKxzc8fBYtzHViHop4d1loq05DlkFOFYi6ht/YBRbE= +gorgonia.org/cu v0.9.1/go.mod h1:LgyAYDkN7HWhh8orGnCY2R8pP9PYbO44ivEbLMatkVU= +gorgonia.org/cu v0.9.3 h1:IkxE4NWXuZHqr8AnmgoB8WNQPZeD6u0EJNxYjDC0YgY= +gorgonia.org/cu v0.9.3/go.mod h1:LgyAYDkN7HWhh8orGnCY2R8pP9PYbO44ivEbLMatkVU= gorgonia.org/dawson v1.1.0 h1:o7+eJ3SKi9sheH19lpOat//tDbg0Y+M9iY/lH79VHqY= gorgonia.org/dawson v1.1.0/go.mod h1:Px1mcziba8YUBIDsbzGwbKJ11uIblv/zkln4jNrZ9Ws= +gorgonia.org/dawson v1.2.0 h1:hJ/aofhfkReSnJdSMDzypRZ/oWDL1TmeYOauBnXKdFw= +gorgonia.org/dawson v1.2.0/go.mod h1:Px1mcziba8YUBIDsbzGwbKJ11uIblv/zkln4jNrZ9Ws= +gorgonia.org/gorgonia v0.9.2/go.mod h1:ZtOb9f/wM2OMta1ISGspQ4roGDgz9d9dKOaPNvGR+ec= gorgonia.org/gorgonia v0.9.4 h1:msE583U+EuthijznpLPJ1Uk6LbNqZCWX/5mgq/L/EGg= gorgonia.org/gorgonia v0.9.4/go.mod h1:4kWgOIjKmCaY1H4JbMfhF6JXXNcbLpbCZ7m9EjVyZOY= +gorgonia.org/gorgonia v0.9.7 h1:WhkbtBZtvFV8X4T0X81GiUgh8m/mfBFmOB7uc3sJUtE= +gorgonia.org/gorgonia v0.9.7/go.mod h1:9MCLQcNogyci6yODZcj5i+dH0G5CkNlQ0w/Yr+HKSJc= +gorgonia.org/gorgonia v0.9.8 h1:kqW/MYUy2NfAV75hKJzF9O9u/bi206BDb0N+vel5oSg= +gorgonia.org/gorgonia v0.9.8/go.mod h1:9MCLQcNogyci6yODZcj5i+dH0G5CkNlQ0w/Yr+HKSJc= +gorgonia.org/gorgonia v0.9.11 h1:oKmiHP0R9mK0rZ3XWpMRGfTbz+0xRWQKeVpKtLFFeyk= +gorgonia.org/gorgonia v0.9.11/go.mod h1:/kiQerfkzE3brxu67hQ2oCLhQ5QVc0UjaYWF4811R40= gorgonia.org/tensor v0.9.0-beta/go.mod h1:05Y4laKuVlj4qFoZIZW1q/9n1jZkgDBOLmKXZdBLG1w= +gorgonia.org/tensor v0.9.2/go.mod h1:603c/8huGtNc1APqh1nWqQu0fYgBvkwt55rvg4CWgZs= gorgonia.org/tensor v0.9.3 h1:lNbhJqiPaEdBoPyj6I6uhhWQKMBtLQXUOX+gxL5JBWc= gorgonia.org/tensor v0.9.3/go.mod h1:603c/8huGtNc1APqh1nWqQu0fYgBvkwt55rvg4CWgZs= +gorgonia.org/tensor v0.9.4 h1:5RRPp6tz3fRzIni1cMQyWT9QEQpfvu8cXibcEqU0GDU= +gorgonia.org/tensor v0.9.4/go.mod h1:603c/8huGtNc1APqh1nWqQu0fYgBvkwt55rvg4CWgZs= +gorgonia.org/tensor v0.9.7 h1:RncmNWe66zWDGMpDYFRXmReFkkMK7KOstELU/joamao= +gorgonia.org/tensor v0.9.7/go.mod h1:yYvRwsd34UdhG98GhzsB4YUVt3cQAQ4amoD/nuyhX+c= gorgonia.org/vecf32 v0.7.0/go.mod h1:iHG+kvTMqGYA0SgahfO2k62WRnxmHsqAREGbayRDzy8= gorgonia.org/vecf32 v0.9.0 h1:PClazic1r+JVJ1dEzRXgeiVl4g1/Hf/w+wUSqnco1Xg= gorgonia.org/vecf32 v0.9.0/go.mod h1:NCc+5D2oxddRL11hd+pCB1PEyXWOyiQxfZ/1wwhOXCA= gorgonia.org/vecf64 v0.7.0/go.mod h1:1y4pmcSd+wh3phG+InwWQjYrqwyrtN9h27WLFVQfV1Q= gorgonia.org/vecf64 v0.9.0 h1:bgZDP5x0OzBF64PjMGC3EvTdOoMEcmfAh1VCUnZFm1A= gorgonia.org/vecf64 v0.9.0/go.mod h1:hp7IOWCnRiVQKON73kkC/AUMtEXyf9kGlVrtPQ9ccVA= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw= +modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= +modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= +modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= +modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/internal/onnx/ir/onnx.proto3.pb.go b/internal/onnx/ir/onnx.proto3.pb.go index 99e3da98..0f6aa14a 100644 --- a/internal/onnx/ir/onnx.proto3.pb.go +++ b/internal/onnx/ir/onnx.proto3.pb.go @@ -1,13 +1,15 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. +// Code generated by protoc-gen-gogo. DO NOT EDIT. // source: onnx.proto3 package ir import ( + encoding_binary "encoding/binary" fmt "fmt" + io "io" math "math" - proto "github.com/golang/protobuf/proto" + proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. @@ -19,7 +21,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package // Versioning // @@ -36,7 +38,7 @@ const ( // The version field is always serialized and we will use it to store the // version that the graph is generated from. This helps us set up version // control. - // For the IR, we are using simple numbers starting with with 0x00000001, + // For the IR, we are using simple numbers starting with 0x00000001, // which was the version we published on Oct 10, 2017. Version_IR_VERSION_2017_10_10 Version = 1 // IR_VERSION 2 published on Oct 30, 2017 @@ -47,21 +49,40 @@ const ( // - Added new message OperatorSetIdProto // - Added opset_import in ModelProto // - For vendor extensions, added domain in NodeProto - Version_IR_VERSION Version = 3 + Version_IR_VERSION_2017_11_3 Version = 3 + // IR VERSION 4 published on Jan 22, 2019 + // - Relax constraint that initializers should be a subset of graph inputs + // - Add type BFLOAT16 + Version_IR_VERSION_2019_1_22 Version = 4 + // IR VERSION 5 published on March 18, 2019 + // - Add message TensorAnnotation. + // - Add quantization annotation in GraphProto to map tensor with its scale and zero point quantization parameters. + Version_IR_VERSION_2019_3_18 Version = 5 + // IR VERSION 6 published on Sep 19, 2019 + // - Add support for sparse tensor constants stored in model. + // - Add message SparseTensorProto + // - Add sparse initializers + Version_IR_VERSION Version = 6 ) var Version_name = map[int32]string{ 0: "_START_VERSION", 1: "IR_VERSION_2017_10_10", 2: "IR_VERSION_2017_10_30", - 3: "IR_VERSION", + 3: "IR_VERSION_2017_11_3", + 4: "IR_VERSION_2019_1_22", + 5: "IR_VERSION_2019_3_18", + 6: "IR_VERSION", } var Version_value = map[string]int32{ "_START_VERSION": 0, "IR_VERSION_2017_10_10": 1, "IR_VERSION_2017_10_30": 2, - "IR_VERSION": 3, + "IR_VERSION_2017_11_3": 3, + "IR_VERSION_2019_1_22": 4, + "IR_VERSION_2019_3_18": 5, + "IR_VERSION": 6, } func (x Version) String() string { @@ -77,17 +98,19 @@ func (Version) EnumDescriptor() ([]byte, []int) { type AttributeProto_AttributeType int32 const ( - AttributeProto_UNDEFINED AttributeProto_AttributeType = 0 - AttributeProto_FLOAT AttributeProto_AttributeType = 1 - AttributeProto_INT AttributeProto_AttributeType = 2 - AttributeProto_STRING AttributeProto_AttributeType = 3 - AttributeProto_TENSOR AttributeProto_AttributeType = 4 - AttributeProto_GRAPH AttributeProto_AttributeType = 5 - AttributeProto_FLOATS AttributeProto_AttributeType = 6 - AttributeProto_INTS AttributeProto_AttributeType = 7 - AttributeProto_STRINGS AttributeProto_AttributeType = 8 - AttributeProto_TENSORS AttributeProto_AttributeType = 9 - AttributeProto_GRAPHS AttributeProto_AttributeType = 10 + AttributeProto_UNDEFINED AttributeProto_AttributeType = 0 + AttributeProto_FLOAT AttributeProto_AttributeType = 1 + AttributeProto_INT AttributeProto_AttributeType = 2 + AttributeProto_STRING AttributeProto_AttributeType = 3 + AttributeProto_TENSOR AttributeProto_AttributeType = 4 + AttributeProto_GRAPH AttributeProto_AttributeType = 5 + AttributeProto_SPARSE_TENSOR AttributeProto_AttributeType = 11 + AttributeProto_FLOATS AttributeProto_AttributeType = 6 + AttributeProto_INTS AttributeProto_AttributeType = 7 + AttributeProto_STRINGS AttributeProto_AttributeType = 8 + AttributeProto_TENSORS AttributeProto_AttributeType = 9 + AttributeProto_GRAPHS AttributeProto_AttributeType = 10 + AttributeProto_SPARSE_TENSORS AttributeProto_AttributeType = 12 ) var AttributeProto_AttributeType_name = map[int32]string{ @@ -97,25 +120,29 @@ var AttributeProto_AttributeType_name = map[int32]string{ 3: "STRING", 4: "TENSOR", 5: "GRAPH", + 11: "SPARSE_TENSOR", 6: "FLOATS", 7: "INTS", 8: "STRINGS", 9: "TENSORS", 10: "GRAPHS", + 12: "SPARSE_TENSORS", } var AttributeProto_AttributeType_value = map[string]int32{ - "UNDEFINED": 0, - "FLOAT": 1, - "INT": 2, - "STRING": 3, - "TENSOR": 4, - "GRAPH": 5, - "FLOATS": 6, - "INTS": 7, - "STRINGS": 8, - "TENSORS": 9, - "GRAPHS": 10, + "UNDEFINED": 0, + "FLOAT": 1, + "INT": 2, + "STRING": 3, + "TENSOR": 4, + "GRAPH": 5, + "SPARSE_TENSOR": 11, + "FLOATS": 6, + "INTS": 7, + "STRINGS": 8, + "TENSORS": 9, + "GRAPHS": 10, + "SPARSE_TENSORS": 12, } func (x AttributeProto_AttributeType) String() string { @@ -199,7 +226,35 @@ func (x TensorProto_DataType) String() string { } func (TensorProto_DataType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_d0206993eefcdc9e, []int{6, 0} + return fileDescriptor_d0206993eefcdc9e, []int{7, 0} +} + +// Location of the data for this tensor. MUST be one of: +// - DEFAULT - data stored inside the protobuf message. Data is stored in raw_data (if set) otherwise in type-specified field. +// - EXTERNAL - data stored in an external location as described by external_data field. +type TensorProto_DataLocation int32 + +const ( + TensorProto_DEFAULT TensorProto_DataLocation = 0 + TensorProto_EXTERNAL TensorProto_DataLocation = 1 +) + +var TensorProto_DataLocation_name = map[int32]string{ + 0: "DEFAULT", + 1: "EXTERNAL", +} + +var TensorProto_DataLocation_value = map[string]int32{ + "DEFAULT": 0, + "EXTERNAL": 1, +} + +func (x TensorProto_DataLocation) String() string { + return proto.EnumName(TensorProto_DataLocation_name, int32(x)) +} + +func (TensorProto_DataLocation) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_d0206993eefcdc9e, []int{7, 1} } // Attributes @@ -220,25 +275,24 @@ type AttributeProto struct { DocString string `protobuf:"bytes,13,opt,name=doc_string,json=docString,proto3" json:"doc_string,omitempty"` // The type field MUST be present for this version of the IR. // For 0.0.1 versions of the IR, this field was not defined, and - // implementations needed to use has_field hueristics to determine + // implementations needed to use has_field heuristics to determine // which value field was in use. For IR_VERSION 0.0.2 or later, this // field MUST be set and match the f|i|s|t|... field in use. This - // change was made to accomodate proto3 implementations. + // change was made to accommodate proto3 implementations. Type AttributeProto_AttributeType `protobuf:"varint,20,opt,name=type,proto3,enum=onnx.AttributeProto_AttributeType" json:"type,omitempty"` // Exactly ONE of the following fields must be present for this version of the IR - F float32 `protobuf:"fixed32,2,opt,name=f,proto3" json:"f,omitempty"` - I int64 `protobuf:"varint,3,opt,name=i,proto3" json:"i,omitempty"` - S []byte `protobuf:"bytes,4,opt,name=s,proto3" json:"s,omitempty"` - T *TensorProto `protobuf:"bytes,5,opt,name=t,proto3" json:"t,omitempty"` - G *GraphProto `protobuf:"bytes,6,opt,name=g,proto3" json:"g,omitempty"` - Floats []float32 `protobuf:"fixed32,7,rep,packed,name=floats,proto3" json:"floats,omitempty"` - Ints []int64 `protobuf:"varint,8,rep,packed,name=ints,proto3" json:"ints,omitempty"` - Strings [][]byte `protobuf:"bytes,9,rep,name=strings,proto3" json:"strings,omitempty"` - Tensors []*TensorProto `protobuf:"bytes,10,rep,name=tensors,proto3" json:"tensors,omitempty"` - Graphs []*GraphProto `protobuf:"bytes,11,rep,name=graphs,proto3" json:"graphs,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + F float32 `protobuf:"fixed32,2,opt,name=f,proto3" json:"f,omitempty"` + I int64 `protobuf:"varint,3,opt,name=i,proto3" json:"i,omitempty"` + S []byte `protobuf:"bytes,4,opt,name=s,proto3" json:"s,omitempty"` + T *TensorProto `protobuf:"bytes,5,opt,name=t,proto3" json:"t,omitempty"` + G *GraphProto `protobuf:"bytes,6,opt,name=g,proto3" json:"g,omitempty"` + SparseTensor *SparseTensorProto `protobuf:"bytes,22,opt,name=sparse_tensor,json=sparseTensor,proto3" json:"sparse_tensor,omitempty"` + Floats []float32 `protobuf:"fixed32,7,rep,packed,name=floats,proto3" json:"floats,omitempty"` + Ints []int64 `protobuf:"varint,8,rep,packed,name=ints,proto3" json:"ints,omitempty"` + Strings [][]byte `protobuf:"bytes,9,rep,name=strings,proto3" json:"strings,omitempty"` + Tensors []*TensorProto `protobuf:"bytes,10,rep,name=tensors,proto3" json:"tensors,omitempty"` + Graphs []*GraphProto `protobuf:"bytes,11,rep,name=graphs,proto3" json:"graphs,omitempty"` + SparseTensors []*SparseTensorProto `protobuf:"bytes,23,rep,name=sparse_tensors,json=sparseTensors,proto3" json:"sparse_tensors,omitempty"` } func (m *AttributeProto) Reset() { *m = AttributeProto{} } @@ -247,18 +301,26 @@ func (*AttributeProto) ProtoMessage() {} func (*AttributeProto) Descriptor() ([]byte, []int) { return fileDescriptor_d0206993eefcdc9e, []int{0} } - func (m *AttributeProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_AttributeProto.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *AttributeProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_AttributeProto.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_AttributeProto.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *AttributeProto) XXX_Merge(src proto.Message) { xxx_messageInfo_AttributeProto.Merge(m, src) } func (m *AttributeProto) XXX_Size() int { - return xxx_messageInfo_AttributeProto.Size(m) + return m.Size() } func (m *AttributeProto) XXX_DiscardUnknown() { xxx_messageInfo_AttributeProto.DiscardUnknown(m) @@ -329,6 +391,13 @@ func (m *AttributeProto) GetG() *GraphProto { return nil } +func (m *AttributeProto) GetSparseTensor() *SparseTensorProto { + if m != nil { + return m.SparseTensor + } + return nil +} + func (m *AttributeProto) GetFloats() []float32 { if m != nil { return m.Floats @@ -364,18 +433,23 @@ func (m *AttributeProto) GetGraphs() []*GraphProto { return nil } +func (m *AttributeProto) GetSparseTensors() []*SparseTensorProto { + if m != nil { + return m.SparseTensors + } + return nil +} + // Defines information on value, including the name, the type, and // the shape of the value. type ValueInfoProto struct { // This field MUST be present in this version of the IR. Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // This field MUST be present in this version of the IR. + // This field MUST be present in this version of the IR for + // inputs and outputs of the top-level graph. Type *TypeProto `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` // A human-readable documentation for this value. Markdown is allowed. - DocString string `protobuf:"bytes,3,opt,name=doc_string,json=docString,proto3" json:"doc_string,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + DocString string `protobuf:"bytes,3,opt,name=doc_string,json=docString,proto3" json:"doc_string,omitempty"` } func (m *ValueInfoProto) Reset() { *m = ValueInfoProto{} } @@ -384,18 +458,26 @@ func (*ValueInfoProto) ProtoMessage() {} func (*ValueInfoProto) Descriptor() ([]byte, []int) { return fileDescriptor_d0206993eefcdc9e, []int{1} } - func (m *ValueInfoProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ValueInfoProto.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *ValueInfoProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ValueInfoProto.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_ValueInfoProto.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *ValueInfoProto) XXX_Merge(src proto.Message) { xxx_messageInfo_ValueInfoProto.Merge(m, src) } func (m *ValueInfoProto) XXX_Size() int { - return xxx_messageInfo_ValueInfoProto.Size(m) + return m.Size() } func (m *ValueInfoProto) XXX_DiscardUnknown() { xxx_messageInfo_ValueInfoProto.DiscardUnknown(m) @@ -444,10 +526,7 @@ type NodeProto struct { // Additional named attributes. Attribute []*AttributeProto `protobuf:"bytes,5,rep,name=attribute,proto3" json:"attribute,omitempty"` // A human-readable documentation for this node. Markdown is allowed. - DocString string `protobuf:"bytes,6,opt,name=doc_string,json=docString,proto3" json:"doc_string,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + DocString string `protobuf:"bytes,6,opt,name=doc_string,json=docString,proto3" json:"doc_string,omitempty"` } func (m *NodeProto) Reset() { *m = NodeProto{} } @@ -456,18 +535,26 @@ func (*NodeProto) ProtoMessage() {} func (*NodeProto) Descriptor() ([]byte, []int) { return fileDescriptor_d0206993eefcdc9e, []int{2} } - func (m *NodeProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_NodeProto.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *NodeProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_NodeProto.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_NodeProto.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *NodeProto) XXX_Merge(src proto.Message) { xxx_messageInfo_NodeProto.Merge(m, src) } func (m *NodeProto) XXX_Size() int { - return xxx_messageInfo_NodeProto.Size(m) + return m.Size() } func (m *NodeProto) XXX_DiscardUnknown() { xxx_messageInfo_NodeProto.DiscardUnknown(m) @@ -565,10 +652,7 @@ type ModelProto struct { // The parameterized graph that is evaluated to execute the model. Graph *GraphProto `protobuf:"bytes,7,opt,name=graph,proto3" json:"graph,omitempty"` // Named metadata values; keys should be distinct. - MetadataProps []*StringStringEntryProto `protobuf:"bytes,14,rep,name=metadata_props,json=metadataProps,proto3" json:"metadata_props,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + MetadataProps []*StringStringEntryProto `protobuf:"bytes,14,rep,name=metadata_props,json=metadataProps,proto3" json:"metadata_props,omitempty"` } func (m *ModelProto) Reset() { *m = ModelProto{} } @@ -577,18 +661,26 @@ func (*ModelProto) ProtoMessage() {} func (*ModelProto) Descriptor() ([]byte, []int) { return fileDescriptor_d0206993eefcdc9e, []int{3} } - func (m *ModelProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ModelProto.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *ModelProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ModelProto.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_ModelProto.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *ModelProto) XXX_Merge(src proto.Message) { xxx_messageInfo_ModelProto.Merge(m, src) } func (m *ModelProto) XXX_Size() int { - return xxx_messageInfo_ModelProto.Size(m) + return m.Size() } func (m *ModelProto) XXX_DiscardUnknown() { xxx_messageInfo_ModelProto.DiscardUnknown(m) @@ -662,11 +754,8 @@ func (m *ModelProto) GetMetadataProps() []*StringStringEntryProto { // StringStringEntryProto follows the pattern for cross-proto-version maps. // See https://developers.google.com/protocol-buffers/docs/proto3#maps type StringStringEntryProto struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } func (m *StringStringEntryProto) Reset() { *m = StringStringEntryProto{} } @@ -675,18 +764,26 @@ func (*StringStringEntryProto) ProtoMessage() {} func (*StringStringEntryProto) Descriptor() ([]byte, []int) { return fileDescriptor_d0206993eefcdc9e, []int{4} } - func (m *StringStringEntryProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_StringStringEntryProto.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *StringStringEntryProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_StringStringEntryProto.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_StringStringEntryProto.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *StringStringEntryProto) XXX_Merge(src proto.Message) { xxx_messageInfo_StringStringEntryProto.Merge(m, src) } func (m *StringStringEntryProto) XXX_Size() int { - return xxx_messageInfo_StringStringEntryProto.Size(m) + return m.Size() } func (m *StringStringEntryProto) XXX_DiscardUnknown() { xxx_messageInfo_StringStringEntryProto.DiscardUnknown(m) @@ -708,6 +805,62 @@ func (m *StringStringEntryProto) GetValue() string { return "" } +type TensorAnnotation struct { + TensorName string `protobuf:"bytes,1,opt,name=tensor_name,json=tensorName,proto3" json:"tensor_name,omitempty"` + // pairs to annotate tensor specified by above. + // The keys used in the mapping below must be pre-defined in ONNX spec. + // For example, for 8-bit linear quantization case, 'SCALE_TENSOR', 'ZERO_POINT_TENSOR' will be pre-defined as + // quantization parameter keys. + QuantParameterTensorNames []*StringStringEntryProto `protobuf:"bytes,2,rep,name=quant_parameter_tensor_names,json=quantParameterTensorNames,proto3" json:"quant_parameter_tensor_names,omitempty"` +} + +func (m *TensorAnnotation) Reset() { *m = TensorAnnotation{} } +func (m *TensorAnnotation) String() string { return proto.CompactTextString(m) } +func (*TensorAnnotation) ProtoMessage() {} +func (*TensorAnnotation) Descriptor() ([]byte, []int) { + return fileDescriptor_d0206993eefcdc9e, []int{5} +} +func (m *TensorAnnotation) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TensorAnnotation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TensorAnnotation.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TensorAnnotation) XXX_Merge(src proto.Message) { + xxx_messageInfo_TensorAnnotation.Merge(m, src) +} +func (m *TensorAnnotation) XXX_Size() int { + return m.Size() +} +func (m *TensorAnnotation) XXX_DiscardUnknown() { + xxx_messageInfo_TensorAnnotation.DiscardUnknown(m) +} + +var xxx_messageInfo_TensorAnnotation proto.InternalMessageInfo + +func (m *TensorAnnotation) GetTensorName() string { + if m != nil { + return m.TensorName + } + return "" +} + +func (m *TensorAnnotation) GetQuantParameterTensorNames() []*StringStringEntryProto { + if m != nil { + return m.QuantParameterTensorNames + } + return nil +} + // Graphs // // A graph defines the computational logic of a model and is comprised of a parameterized @@ -721,8 +874,10 @@ type GraphProto struct { Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // A list of named tensor values, used to specify constant inputs of the graph. // Each TensorProto entry must have a distinct name (within the list) that - // also appears in the input list. + // MAY also appear in the input list. Initializer []*TensorProto `protobuf:"bytes,5,rep,name=initializer,proto3" json:"initializer,omitempty"` + // Initializers (see above) stored in sparse format. + SparseInitializer []*SparseTensorProto `protobuf:"bytes,15,rep,name=sparse_initializer,json=sparseInitializer,proto3" json:"sparse_initializer,omitempty"` // A human-readable documentation for this graph. Markdown is allowed. DocString string `protobuf:"bytes,10,opt,name=doc_string,json=docString,proto3" json:"doc_string,omitempty"` // The inputs and outputs of the graph. @@ -730,30 +885,40 @@ type GraphProto struct { Output []*ValueInfoProto `protobuf:"bytes,12,rep,name=output,proto3" json:"output,omitempty"` // Information for the values in the graph. The ValueInfoProto.name's // must be distinct. It is optional for a value to appear in value_info list. - ValueInfo []*ValueInfoProto `protobuf:"bytes,13,rep,name=value_info,json=valueInfo,proto3" json:"value_info,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ValueInfo []*ValueInfoProto `protobuf:"bytes,13,rep,name=value_info,json=valueInfo,proto3" json:"value_info,omitempty"` + // This field carries information to indicate the mapping among a tensor and its + // quantization parameter tensors. For example: + // For tensor 'a', it may have {'SCALE_TENSOR', 'a_scale'} and {'ZERO_POINT_TENSOR', 'a_zero_point'} annotated, + // which means, tensor 'a_scale' and tensor 'a_zero_point' are scale and zero point of tensor 'a' in the model. + QuantizationAnnotation []*TensorAnnotation `protobuf:"bytes,14,rep,name=quantization_annotation,json=quantizationAnnotation,proto3" json:"quantization_annotation,omitempty"` } func (m *GraphProto) Reset() { *m = GraphProto{} } func (m *GraphProto) String() string { return proto.CompactTextString(m) } func (*GraphProto) ProtoMessage() {} func (*GraphProto) Descriptor() ([]byte, []int) { - return fileDescriptor_d0206993eefcdc9e, []int{5} + return fileDescriptor_d0206993eefcdc9e, []int{6} } - func (m *GraphProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_GraphProto.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *GraphProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_GraphProto.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_GraphProto.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *GraphProto) XXX_Merge(src proto.Message) { xxx_messageInfo_GraphProto.Merge(m, src) } func (m *GraphProto) XXX_Size() int { - return xxx_messageInfo_GraphProto.Size(m) + return m.Size() } func (m *GraphProto) XXX_DiscardUnknown() { xxx_messageInfo_GraphProto.DiscardUnknown(m) @@ -782,6 +947,13 @@ func (m *GraphProto) GetInitializer() []*TensorProto { return nil } +func (m *GraphProto) GetSparseInitializer() []*SparseTensorProto { + if m != nil { + return m.SparseInitializer + } + return nil +} + func (m *GraphProto) GetDocString() string { if m != nil { return m.DocString @@ -810,6 +982,13 @@ func (m *GraphProto) GetValueInfo() []*ValueInfoProto { return nil } +func (m *GraphProto) GetQuantizationAnnotation() []*TensorAnnotation { + if m != nil { + return m.QuantizationAnnotation + } + return nil +} + // Tensors // // A serialized tensor value. @@ -823,7 +1002,7 @@ type TensorProto struct { // For float and complex64 values // Complex64 tensors are encoded as a single array of floats, // with the real components appearing in odd numbered positions, - // and the corresponding imaginary component apparing in the + // and the corresponding imaginary component appearing in the // subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] // is encoded as [1.0, 2.0 ,3.0 ,4.0] // When this field is present, the data_type field MUST be FLOAT or COMPLEX64. @@ -863,10 +1042,22 @@ type TensorProto struct { // variable length storage, and may lead to smaller binary footprint. // When this field is present, the data_type field MUST NOT be STRING or UNDEFINED RawData []byte `protobuf:"bytes,9,opt,name=raw_data,json=rawData,proto3" json:"raw_data,omitempty"` + // Data can be stored inside the protobuf file using type-specific fields or raw_data. + // Alternatively, raw bytes data can be stored in an external file, using the external_data field. + // external_data stores key-value pairs describing data location. Recognized keys are: + // - "location" (required) - POSIX filesystem path relative to the directory where the ONNX + // protobuf model was stored + // - "offset" (optional) - position of byte at which stored data begins. Integer stored as string. + // Offset values SHOULD be multiples 4096 (page size) to enable mmap support. + // - "length" (optional) - number of bytes containing data. Integer stored as string. + // - "checksum" (optional) - SHA1 digest of file specified in under 'location' key. + ExternalData []*StringStringEntryProto `protobuf:"bytes,13,rep,name=external_data,json=externalData,proto3" json:"external_data,omitempty"` + // If value not set, data is stored in raw_data (if set) otherwise in type-specified field. + DataLocation TensorProto_DataLocation `protobuf:"varint,14,opt,name=data_location,json=dataLocation,proto3,enum=onnx.TensorProto_DataLocation" json:"data_location,omitempty"` // For double // Complex128 tensors are encoded as a single array of doubles, // with the real components appearing in odd numbered positions, - // and the corresponding imaginary component apparing in the + // and the corresponding imaginary component appearing in the // subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] // is encoded as [1.0, 2.0 ,3.0 ,4.0] // When this field is present, the data_type field MUST be DOUBLE or COMPLEX128 @@ -874,30 +1065,35 @@ type TensorProto struct { // For uint64 and uint32 values // When this field is present, the data_type field MUST be // UINT32 or UINT64 - Uint64Data []uint64 `protobuf:"varint,11,rep,packed,name=uint64_data,json=uint64Data,proto3" json:"uint64_data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Uint64Data []uint64 `protobuf:"varint,11,rep,packed,name=uint64_data,json=uint64Data,proto3" json:"uint64_data,omitempty"` } func (m *TensorProto) Reset() { *m = TensorProto{} } func (m *TensorProto) String() string { return proto.CompactTextString(m) } func (*TensorProto) ProtoMessage() {} func (*TensorProto) Descriptor() ([]byte, []int) { - return fileDescriptor_d0206993eefcdc9e, []int{6} + return fileDescriptor_d0206993eefcdc9e, []int{7} } - func (m *TensorProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TensorProto.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *TensorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TensorProto.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_TensorProto.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *TensorProto) XXX_Merge(src proto.Message) { xxx_messageInfo_TensorProto.Merge(m, src) } func (m *TensorProto) XXX_Size() int { - return xxx_messageInfo_TensorProto.Size(m) + return m.Size() } func (m *TensorProto) XXX_DiscardUnknown() { xxx_messageInfo_TensorProto.DiscardUnknown(m) @@ -975,6 +1171,20 @@ func (m *TensorProto) GetRawData() []byte { return nil } +func (m *TensorProto) GetExternalData() []*StringStringEntryProto { + if m != nil { + return m.ExternalData + } + return nil +} + +func (m *TensorProto) GetDataLocation() TensorProto_DataLocation { + if m != nil { + return m.DataLocation + } + return TensorProto_DEFAULT +} + func (m *TensorProto) GetDoubleData() []float64 { if m != nil { return m.DoubleData @@ -993,31 +1203,36 @@ func (m *TensorProto) GetUint64Data() []uint64 { // case the following fields will specify the segment that is stored in // the current TensorProto. type TensorProto_Segment struct { - Begin int64 `protobuf:"varint,1,opt,name=begin,proto3" json:"begin,omitempty"` - End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Begin int64 `protobuf:"varint,1,opt,name=begin,proto3" json:"begin,omitempty"` + End int64 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"` } func (m *TensorProto_Segment) Reset() { *m = TensorProto_Segment{} } func (m *TensorProto_Segment) String() string { return proto.CompactTextString(m) } func (*TensorProto_Segment) ProtoMessage() {} func (*TensorProto_Segment) Descriptor() ([]byte, []int) { - return fileDescriptor_d0206993eefcdc9e, []int{6, 0} + return fileDescriptor_d0206993eefcdc9e, []int{7, 0} } - func (m *TensorProto_Segment) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TensorProto_Segment.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *TensorProto_Segment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TensorProto_Segment.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_TensorProto_Segment.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *TensorProto_Segment) XXX_Merge(src proto.Message) { xxx_messageInfo_TensorProto_Segment.Merge(m, src) } func (m *TensorProto_Segment) XXX_Size() int { - return xxx_messageInfo_TensorProto_Segment.Size(m) + return m.Size() } func (m *TensorProto_Segment) XXX_DiscardUnknown() { xxx_messageInfo_TensorProto_Segment.DiscardUnknown(m) @@ -1039,34 +1254,113 @@ func (m *TensorProto_Segment) GetEnd() int64 { return 0 } +// A serialized sparse-tensor value +type SparseTensorProto struct { + // The sequence of non-default values are encoded as a tensor of shape [NNZ]. + // The default-value is zero for numeric tensors, and empty-string for string tensors. + Values *TensorProto `protobuf:"bytes,1,opt,name=values,proto3" json:"values,omitempty"` + // The indices of the non-default values, which may be stored in one of two formats. + // (a) Indices can be a tensor of shape [NNZ, rank] with the [i,j]-th value + // corresponding to the j-th index of the i-th value (in the values tensor). + // (b) Indices can be a tensor of shape [NNZ], in which case the i-th value + // must be the linearized-index of the i-th value (in the values tensor). + // The linearized-index can be converted into an index tuple (k_1,...,k_rank) + // using the shape provided below. + // The indices must appear in ascending order without duplication. + // In the first format, the ordering is lexicographic-ordering: + // e.g., index-value [1,4] must appear before [2,1] + Indices *TensorProto `protobuf:"bytes,2,opt,name=indices,proto3" json:"indices,omitempty"` + // The shape of the underlying dense-tensor: [dim_1, dim_2, ... dim_rank] + Dims []int64 `protobuf:"varint,3,rep,packed,name=dims,proto3" json:"dims,omitempty"` +} + +func (m *SparseTensorProto) Reset() { *m = SparseTensorProto{} } +func (m *SparseTensorProto) String() string { return proto.CompactTextString(m) } +func (*SparseTensorProto) ProtoMessage() {} +func (*SparseTensorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_d0206993eefcdc9e, []int{8} +} +func (m *SparseTensorProto) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SparseTensorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SparseTensorProto.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SparseTensorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_SparseTensorProto.Merge(m, src) +} +func (m *SparseTensorProto) XXX_Size() int { + return m.Size() +} +func (m *SparseTensorProto) XXX_DiscardUnknown() { + xxx_messageInfo_SparseTensorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_SparseTensorProto proto.InternalMessageInfo + +func (m *SparseTensorProto) GetValues() *TensorProto { + if m != nil { + return m.Values + } + return nil +} + +func (m *SparseTensorProto) GetIndices() *TensorProto { + if m != nil { + return m.Indices + } + return nil +} + +func (m *SparseTensorProto) GetDims() []int64 { + if m != nil { + return m.Dims + } + return nil +} + // Defines a tensor shape. A dimension can be either an integer value // or a symbolic variable. A symbolic variable represents an unknown // dimension. type TensorShapeProto struct { - Dim []*TensorShapeProto_Dimension `protobuf:"bytes,1,rep,name=dim,proto3" json:"dim,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Dim []*TensorShapeProto_Dimension `protobuf:"bytes,1,rep,name=dim,proto3" json:"dim,omitempty"` } func (m *TensorShapeProto) Reset() { *m = TensorShapeProto{} } func (m *TensorShapeProto) String() string { return proto.CompactTextString(m) } func (*TensorShapeProto) ProtoMessage() {} func (*TensorShapeProto) Descriptor() ([]byte, []int) { - return fileDescriptor_d0206993eefcdc9e, []int{7} + return fileDescriptor_d0206993eefcdc9e, []int{9} } - func (m *TensorShapeProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TensorShapeProto.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *TensorShapeProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TensorShapeProto.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_TensorShapeProto.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *TensorShapeProto) XXX_Merge(src proto.Message) { xxx_messageInfo_TensorShapeProto.Merge(m, src) } func (m *TensorShapeProto) XXX_Size() int { - return xxx_messageInfo_TensorShapeProto.Size(m) + return m.Size() } func (m *TensorShapeProto) XXX_DiscardUnknown() { xxx_messageInfo_TensorShapeProto.DiscardUnknown(m) @@ -1091,30 +1385,35 @@ type TensorShapeProto_Dimension struct { // that operations are applied to the correct axis of a tensor. // Refer to https://github.com/onnx/onnx/blob/master/docs/DimensionDenotation.md#denotation-definition // for pre-defined dimension denotations. - Denotation string `protobuf:"bytes,3,opt,name=denotation,proto3" json:"denotation,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Denotation string `protobuf:"bytes,3,opt,name=denotation,proto3" json:"denotation,omitempty"` } func (m *TensorShapeProto_Dimension) Reset() { *m = TensorShapeProto_Dimension{} } func (m *TensorShapeProto_Dimension) String() string { return proto.CompactTextString(m) } func (*TensorShapeProto_Dimension) ProtoMessage() {} func (*TensorShapeProto_Dimension) Descriptor() ([]byte, []int) { - return fileDescriptor_d0206993eefcdc9e, []int{7, 0} + return fileDescriptor_d0206993eefcdc9e, []int{9, 0} } - func (m *TensorShapeProto_Dimension) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TensorShapeProto_Dimension.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *TensorShapeProto_Dimension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TensorShapeProto_Dimension.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_TensorShapeProto_Dimension.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *TensorShapeProto_Dimension) XXX_Merge(src proto.Message) { xxx_messageInfo_TensorShapeProto_Dimension.Merge(m, src) } func (m *TensorShapeProto_Dimension) XXX_Size() int { - return xxx_messageInfo_TensorShapeProto_Dimension.Size(m) + return m.Size() } func (m *TensorShapeProto_Dimension) XXX_DiscardUnknown() { xxx_messageInfo_TensorShapeProto_Dimension.DiscardUnknown(m) @@ -1124,18 +1423,18 @@ var xxx_messageInfo_TensorShapeProto_Dimension proto.InternalMessageInfo type isTensorShapeProto_Dimension_Value interface { isTensorShapeProto_Dimension_Value() + MarshalTo([]byte) (int, error) + Size() int } type TensorShapeProto_Dimension_DimValue struct { DimValue int64 `protobuf:"varint,1,opt,name=dim_value,json=dimValue,proto3,oneof"` } - type TensorShapeProto_Dimension_DimParam struct { DimParam string `protobuf:"bytes,2,opt,name=dim_param,json=dimParam,proto3,oneof"` } func (*TensorShapeProto_Dimension_DimValue) isTensorShapeProto_Dimension_Value() {} - func (*TensorShapeProto_Dimension_DimParam) isTensorShapeProto_Dimension_Value() {} func (m *TensorShapeProto_Dimension) GetValue() isTensorShapeProto_Dimension_Value { @@ -1166,49 +1465,113 @@ func (m *TensorShapeProto_Dimension) GetDenotation() string { return "" } -// XXX_OneofWrappers is for the internal use of the proto package. -func (*TensorShapeProto_Dimension) XXX_OneofWrappers() []interface{} { - return []interface{}{ +// XXX_OneofFuncs is for the internal use of the proto package. +func (*TensorShapeProto_Dimension) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _TensorShapeProto_Dimension_OneofMarshaler, _TensorShapeProto_Dimension_OneofUnmarshaler, _TensorShapeProto_Dimension_OneofSizer, []interface{}{ (*TensorShapeProto_Dimension_DimValue)(nil), (*TensorShapeProto_Dimension_DimParam)(nil), } } +func _TensorShapeProto_Dimension_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*TensorShapeProto_Dimension) + // value + switch x := m.Value.(type) { + case *TensorShapeProto_Dimension_DimValue: + _ = b.EncodeVarint(1<<3 | proto.WireVarint) + _ = b.EncodeVarint(uint64(x.DimValue)) + case *TensorShapeProto_Dimension_DimParam: + _ = b.EncodeVarint(2<<3 | proto.WireBytes) + _ = b.EncodeStringBytes(x.DimParam) + case nil: + default: + return fmt.Errorf("TensorShapeProto_Dimension.Value has unexpected type %T", x) + } + return nil +} + +func _TensorShapeProto_Dimension_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*TensorShapeProto_Dimension) + switch tag { + case 1: // value.dim_value + if wire != proto.WireVarint { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeVarint() + m.Value = &TensorShapeProto_Dimension_DimValue{int64(x)} + return true, err + case 2: // value.dim_param + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Value = &TensorShapeProto_Dimension_DimParam{x} + return true, err + default: + return false, nil + } +} + +func _TensorShapeProto_Dimension_OneofSizer(msg proto.Message) (n int) { + m := msg.(*TensorShapeProto_Dimension) + // value + switch x := m.Value.(type) { + case *TensorShapeProto_Dimension_DimValue: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(x.DimValue)) + case *TensorShapeProto_Dimension_DimParam: + n += 1 // tag and wire + n += proto.SizeVarint(uint64(len(x.DimParam))) + n += len(x.DimParam) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + // Types // // The standard ONNX data types. type TypeProto struct { // Types that are valid to be assigned to Value: // *TypeProto_TensorType + // *TypeProto_SequenceType + // *TypeProto_MapType Value isTypeProto_Value `protobuf_oneof:"value"` // An optional denotation can be used to denote the whole // type with a standard semantic description as to what is // stored inside. Refer to https://github.com/onnx/onnx/blob/master/docs/TypeDenotation.md#type-denotation-definition // for pre-defined type denotations. - Denotation string `protobuf:"bytes,6,opt,name=denotation,proto3" json:"denotation,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Denotation string `protobuf:"bytes,6,opt,name=denotation,proto3" json:"denotation,omitempty"` } func (m *TypeProto) Reset() { *m = TypeProto{} } func (m *TypeProto) String() string { return proto.CompactTextString(m) } func (*TypeProto) ProtoMessage() {} func (*TypeProto) Descriptor() ([]byte, []int) { - return fileDescriptor_d0206993eefcdc9e, []int{8} + return fileDescriptor_d0206993eefcdc9e, []int{10} } - func (m *TypeProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TypeProto.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *TypeProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TypeProto.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_TypeProto.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *TypeProto) XXX_Merge(src proto.Message) { xxx_messageInfo_TypeProto.Merge(m, src) } func (m *TypeProto) XXX_Size() int { - return xxx_messageInfo_TypeProto.Size(m) + return m.Size() } func (m *TypeProto) XXX_DiscardUnknown() { xxx_messageInfo_TypeProto.DiscardUnknown(m) @@ -1218,13 +1581,23 @@ var xxx_messageInfo_TypeProto proto.InternalMessageInfo type isTypeProto_Value interface { isTypeProto_Value() + MarshalTo([]byte) (int, error) + Size() int } type TypeProto_TensorType struct { TensorType *TypeProto_Tensor `protobuf:"bytes,1,opt,name=tensor_type,json=tensorType,proto3,oneof"` } +type TypeProto_SequenceType struct { + SequenceType *TypeProto_Sequence `protobuf:"bytes,4,opt,name=sequence_type,json=sequenceType,proto3,oneof"` +} +type TypeProto_MapType struct { + MapType *TypeProto_Map `protobuf:"bytes,5,opt,name=map_type,json=mapType,proto3,oneof"` +} -func (*TypeProto_TensorType) isTypeProto_Value() {} +func (*TypeProto_TensorType) isTypeProto_Value() {} +func (*TypeProto_SequenceType) isTypeProto_Value() {} +func (*TypeProto_MapType) isTypeProto_Value() {} func (m *TypeProto) GetValue() isTypeProto_Value { if m != nil { @@ -1240,6 +1613,20 @@ func (m *TypeProto) GetTensorType() *TypeProto_Tensor { return nil } +func (m *TypeProto) GetSequenceType() *TypeProto_Sequence { + if x, ok := m.GetValue().(*TypeProto_SequenceType); ok { + return x.SequenceType + } + return nil +} + +func (m *TypeProto) GetMapType() *TypeProto_Map { + if x, ok := m.GetValue().(*TypeProto_MapType); ok { + return x.MapType + } + return nil +} + func (m *TypeProto) GetDenotation() string { if m != nil { return m.Denotation @@ -1247,42 +1634,133 @@ func (m *TypeProto) GetDenotation() string { return "" } -// XXX_OneofWrappers is for the internal use of the proto package. -func (*TypeProto) XXX_OneofWrappers() []interface{} { - return []interface{}{ +// XXX_OneofFuncs is for the internal use of the proto package. +func (*TypeProto) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _TypeProto_OneofMarshaler, _TypeProto_OneofUnmarshaler, _TypeProto_OneofSizer, []interface{}{ (*TypeProto_TensorType)(nil), + (*TypeProto_SequenceType)(nil), + (*TypeProto_MapType)(nil), + } +} + +func _TypeProto_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*TypeProto) + // value + switch x := m.Value.(type) { + case *TypeProto_TensorType: + _ = b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.TensorType); err != nil { + return err + } + case *TypeProto_SequenceType: + _ = b.EncodeVarint(4<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.SequenceType); err != nil { + return err + } + case *TypeProto_MapType: + _ = b.EncodeVarint(5<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.MapType); err != nil { + return err + } + case nil: + default: + return fmt.Errorf("TypeProto.Value has unexpected type %T", x) + } + return nil +} + +func _TypeProto_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*TypeProto) + switch tag { + case 1: // value.tensor_type + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(TypeProto_Tensor) + err := b.DecodeMessage(msg) + m.Value = &TypeProto_TensorType{msg} + return true, err + case 4: // value.sequence_type + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(TypeProto_Sequence) + err := b.DecodeMessage(msg) + m.Value = &TypeProto_SequenceType{msg} + return true, err + case 5: // value.map_type + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(TypeProto_Map) + err := b.DecodeMessage(msg) + m.Value = &TypeProto_MapType{msg} + return true, err + default: + return false, nil + } +} + +func _TypeProto_OneofSizer(msg proto.Message) (n int) { + m := msg.(*TypeProto) + // value + switch x := m.Value.(type) { + case *TypeProto_TensorType: + s := proto.Size(x.TensorType) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *TypeProto_SequenceType: + s := proto.Size(x.SequenceType) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case *TypeProto_MapType: + s := proto.Size(x.MapType) + n += 1 // tag and wire + n += proto.SizeVarint(uint64(s)) + n += s + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) } + return n } type TypeProto_Tensor struct { // This field MUST NOT have the value of UNDEFINED // This field MUST have a valid TensorProto.DataType value // This field MUST be present for this version of the IR. - ElemType int32 `protobuf:"varint,1,opt,name=elem_type,json=elemType,proto3" json:"elem_type,omitempty"` - Shape *TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ElemType int32 `protobuf:"varint,1,opt,name=elem_type,json=elemType,proto3" json:"elem_type,omitempty"` + Shape *TensorShapeProto `protobuf:"bytes,2,opt,name=shape,proto3" json:"shape,omitempty"` } func (m *TypeProto_Tensor) Reset() { *m = TypeProto_Tensor{} } func (m *TypeProto_Tensor) String() string { return proto.CompactTextString(m) } func (*TypeProto_Tensor) ProtoMessage() {} func (*TypeProto_Tensor) Descriptor() ([]byte, []int) { - return fileDescriptor_d0206993eefcdc9e, []int{8, 0} + return fileDescriptor_d0206993eefcdc9e, []int{10, 0} } - func (m *TypeProto_Tensor) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TypeProto_Tensor.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *TypeProto_Tensor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TypeProto_Tensor.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_TypeProto_Tensor.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *TypeProto_Tensor) XXX_Merge(src proto.Message) { xxx_messageInfo_TypeProto_Tensor.Merge(m, src) } func (m *TypeProto_Tensor) XXX_Size() int { - return xxx_messageInfo_TypeProto_Tensor.Size(m) + return m.Size() } func (m *TypeProto_Tensor) XXX_DiscardUnknown() { xxx_messageInfo_TypeProto_Tensor.DiscardUnknown(m) @@ -1304,6 +1782,110 @@ func (m *TypeProto_Tensor) GetShape() *TensorShapeProto { return nil } +// repeated T +type TypeProto_Sequence struct { + // The type and optional shape of each element of the sequence. + // This field MUST be present for this version of the IR. + ElemType *TypeProto `protobuf:"bytes,1,opt,name=elem_type,json=elemType,proto3" json:"elem_type,omitempty"` +} + +func (m *TypeProto_Sequence) Reset() { *m = TypeProto_Sequence{} } +func (m *TypeProto_Sequence) String() string { return proto.CompactTextString(m) } +func (*TypeProto_Sequence) ProtoMessage() {} +func (*TypeProto_Sequence) Descriptor() ([]byte, []int) { + return fileDescriptor_d0206993eefcdc9e, []int{10, 1} +} +func (m *TypeProto_Sequence) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TypeProto_Sequence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TypeProto_Sequence.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TypeProto_Sequence) XXX_Merge(src proto.Message) { + xxx_messageInfo_TypeProto_Sequence.Merge(m, src) +} +func (m *TypeProto_Sequence) XXX_Size() int { + return m.Size() +} +func (m *TypeProto_Sequence) XXX_DiscardUnknown() { + xxx_messageInfo_TypeProto_Sequence.DiscardUnknown(m) +} + +var xxx_messageInfo_TypeProto_Sequence proto.InternalMessageInfo + +func (m *TypeProto_Sequence) GetElemType() *TypeProto { + if m != nil { + return m.ElemType + } + return nil +} + +// map +type TypeProto_Map struct { + // This field MUST have a valid TensorProto.DataType value + // This field MUST be present for this version of the IR. + // This field MUST refer to an integral type ([U]INT{8|16|32|64}) or STRING + KeyType int32 `protobuf:"varint,1,opt,name=key_type,json=keyType,proto3" json:"key_type,omitempty"` + // This field MUST be present for this version of the IR. + ValueType *TypeProto `protobuf:"bytes,2,opt,name=value_type,json=valueType,proto3" json:"value_type,omitempty"` +} + +func (m *TypeProto_Map) Reset() { *m = TypeProto_Map{} } +func (m *TypeProto_Map) String() string { return proto.CompactTextString(m) } +func (*TypeProto_Map) ProtoMessage() {} +func (*TypeProto_Map) Descriptor() ([]byte, []int) { + return fileDescriptor_d0206993eefcdc9e, []int{10, 2} +} +func (m *TypeProto_Map) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TypeProto_Map) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TypeProto_Map.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TypeProto_Map) XXX_Merge(src proto.Message) { + xxx_messageInfo_TypeProto_Map.Merge(m, src) +} +func (m *TypeProto_Map) XXX_Size() int { + return m.Size() +} +func (m *TypeProto_Map) XXX_DiscardUnknown() { + xxx_messageInfo_TypeProto_Map.DiscardUnknown(m) +} + +var xxx_messageInfo_TypeProto_Map proto.InternalMessageInfo + +func (m *TypeProto_Map) GetKeyType() int32 { + if m != nil { + return m.KeyType + } + return 0 +} + +func (m *TypeProto_Map) GetValueType() *TypeProto { + if m != nil { + return m.ValueType + } + return nil +} + // Operator Sets // // OperatorSets are uniquely identified by a (domain, opset_version) pair. @@ -1315,30 +1897,35 @@ type OperatorSetIdProto struct { Domain string `protobuf:"bytes,1,opt,name=domain,proto3" json:"domain,omitempty"` // The version of the operator set being identified. // This field MUST be present in this version of the IR. - Version int64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Version int64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` } func (m *OperatorSetIdProto) Reset() { *m = OperatorSetIdProto{} } func (m *OperatorSetIdProto) String() string { return proto.CompactTextString(m) } func (*OperatorSetIdProto) ProtoMessage() {} func (*OperatorSetIdProto) Descriptor() ([]byte, []int) { - return fileDescriptor_d0206993eefcdc9e, []int{9} + return fileDescriptor_d0206993eefcdc9e, []int{11} } - func (m *OperatorSetIdProto) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_OperatorSetIdProto.Unmarshal(m, b) + return m.Unmarshal(b) } func (m *OperatorSetIdProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_OperatorSetIdProto.Marshal(b, m, deterministic) + if deterministic { + return xxx_messageInfo_OperatorSetIdProto.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } } func (m *OperatorSetIdProto) XXX_Merge(src proto.Message) { xxx_messageInfo_OperatorSetIdProto.Merge(m, src) } func (m *OperatorSetIdProto) XXX_Size() int { - return xxx_messageInfo_OperatorSetIdProto.Size(m) + return m.Size() } func (m *OperatorSetIdProto) XXX_DiscardUnknown() { xxx_messageInfo_OperatorSetIdProto.DiscardUnknown(m) @@ -1364,106 +1951,5421 @@ func init() { proto.RegisterEnum("onnx.Version", Version_name, Version_value) proto.RegisterEnum("onnx.AttributeProto_AttributeType", AttributeProto_AttributeType_name, AttributeProto_AttributeType_value) proto.RegisterEnum("onnx.TensorProto_DataType", TensorProto_DataType_name, TensorProto_DataType_value) + proto.RegisterEnum("onnx.TensorProto_DataLocation", TensorProto_DataLocation_name, TensorProto_DataLocation_value) proto.RegisterType((*AttributeProto)(nil), "onnx.AttributeProto") proto.RegisterType((*ValueInfoProto)(nil), "onnx.ValueInfoProto") proto.RegisterType((*NodeProto)(nil), "onnx.NodeProto") proto.RegisterType((*ModelProto)(nil), "onnx.ModelProto") proto.RegisterType((*StringStringEntryProto)(nil), "onnx.StringStringEntryProto") + proto.RegisterType((*TensorAnnotation)(nil), "onnx.TensorAnnotation") proto.RegisterType((*GraphProto)(nil), "onnx.GraphProto") proto.RegisterType((*TensorProto)(nil), "onnx.TensorProto") proto.RegisterType((*TensorProto_Segment)(nil), "onnx.TensorProto.Segment") + proto.RegisterType((*SparseTensorProto)(nil), "onnx.SparseTensorProto") proto.RegisterType((*TensorShapeProto)(nil), "onnx.TensorShapeProto") proto.RegisterType((*TensorShapeProto_Dimension)(nil), "onnx.TensorShapeProto.Dimension") proto.RegisterType((*TypeProto)(nil), "onnx.TypeProto") proto.RegisterType((*TypeProto_Tensor)(nil), "onnx.TypeProto.Tensor") + proto.RegisterType((*TypeProto_Sequence)(nil), "onnx.TypeProto.Sequence") + proto.RegisterType((*TypeProto_Map)(nil), "onnx.TypeProto.Map") proto.RegisterType((*OperatorSetIdProto)(nil), "onnx.OperatorSetIdProto") } func init() { proto.RegisterFile("onnx.proto3", fileDescriptor_d0206993eefcdc9e) } var fileDescriptor_d0206993eefcdc9e = []byte{ - // 1327 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x56, 0xcd, 0x6e, 0xdb, 0x46, - 0x10, 0x36, 0x45, 0x51, 0x14, 0x87, 0x92, 0xb2, 0x5d, 0x24, 0x2e, 0x93, 0x36, 0x89, 0x2a, 0x03, - 0x85, 0x9a, 0x06, 0x86, 0x25, 0x19, 0x6a, 0x8a, 0x5e, 0x6a, 0xc7, 0x4a, 0x22, 0xc0, 0x91, 0x8c, - 0xa5, 0x12, 0xf4, 0x46, 0xd0, 0xe6, 0xca, 0x21, 0x6a, 0xfe, 0x80, 0x5c, 0x25, 0x75, 0x6f, 0x7d, - 0x84, 0x3e, 0x44, 0x81, 0x3e, 0x43, 0x7b, 0xed, 0x0b, 0xf4, 0xda, 0xa7, 0x29, 0x76, 0x96, 0xd4, - 0x5f, 0x1c, 0x5f, 0x84, 0x9d, 0x99, 0x6f, 0x86, 0xb3, 0x33, 0xdf, 0xec, 0x08, 0xec, 0x24, 0x8e, - 0x7f, 0xd9, 0x4f, 0xb3, 0x44, 0x24, 0x03, 0x5a, 0x95, 0x42, 0xe7, 0xef, 0x2a, 0xb4, 0x8e, 0x84, - 0xc8, 0xc2, 0xf3, 0x85, 0xe0, 0x67, 0xd2, 0x42, 0x29, 0x54, 0x63, 0x3f, 0xe2, 0x8e, 0xd6, 0xd6, - 0xba, 0x16, 0xc3, 0x33, 0xed, 0x40, 0x33, 0xe3, 0x73, 0xcf, 0x17, 0x22, 0xf3, 0xd0, 0x78, 0x0f, - 0x8d, 0x76, 0xc6, 0xe7, 0xd2, 0x7b, 0x22, 0x31, 0x0f, 0x01, 0x82, 0xe4, 0xc2, 0xcb, 0x45, 0x16, - 0xc6, 0x97, 0x4e, 0x13, 0x01, 0x56, 0x90, 0x5c, 0xb8, 0xa8, 0xa0, 0x43, 0xa8, 0x8a, 0xeb, 0x94, - 0x3b, 0x77, 0xdb, 0x5a, 0xb7, 0xd5, 0xef, 0xec, 0x63, 0x2e, 0x9b, 0x9f, 0x5e, 0x89, 0xb3, 0xeb, - 0x94, 0x33, 0xc4, 0xd3, 0x06, 0x68, 0x73, 0xa7, 0xd2, 0xd6, 0xba, 0x15, 0xa6, 0xcd, 0xa5, 0x14, - 0x3a, 0x7a, 0x5b, 0xeb, 0xea, 0x4c, 0x0b, 0xa5, 0x94, 0x3b, 0xd5, 0xb6, 0xd6, 0x6d, 0x30, 0x2d, - 0xa7, 0x8f, 0x41, 0x13, 0x8e, 0xd1, 0xd6, 0xba, 0x76, 0xff, 0x33, 0x15, 0x7e, 0xc6, 0xe3, 0x3c, - 0xc9, 0x30, 0x36, 0xd3, 0x04, 0x7d, 0x04, 0xda, 0xa5, 0x53, 0x43, 0x00, 0x51, 0x80, 0x97, 0x99, - 0x9f, 0xbe, 0x2b, 0xec, 0x97, 0x74, 0x17, 0x6a, 0xf3, 0xab, 0xc4, 0x17, 0xb9, 0x63, 0xb6, 0xf5, - 0x6e, 0x85, 0x15, 0x92, 0xac, 0x48, 0x18, 0x8b, 0xdc, 0xa9, 0xb7, 0xf5, 0xae, 0xce, 0xf0, 0x4c, - 0x1d, 0x30, 0xd5, 0x4d, 0x73, 0xc7, 0x6a, 0xeb, 0xdd, 0x06, 0x2b, 0x45, 0xfa, 0x2d, 0x98, 0x02, - 0xbf, 0x9b, 0x3b, 0xd0, 0xd6, 0x6f, 0x4e, 0xa6, 0x44, 0xd0, 0x2e, 0xd4, 0x2e, 0x65, 0x0e, 0xb9, - 0x63, 0x23, 0xf6, 0xe3, 0xbc, 0x0a, 0x7b, 0xe7, 0x77, 0x0d, 0x9a, 0x1b, 0xf5, 0xa1, 0x4d, 0xb0, - 0xde, 0x4c, 0x4e, 0x46, 0x2f, 0xc6, 0x93, 0xd1, 0x09, 0xd9, 0xa1, 0x16, 0x18, 0x2f, 0x4e, 0xa7, - 0x47, 0x33, 0xa2, 0x51, 0x13, 0xf4, 0xf1, 0x64, 0x46, 0x2a, 0x14, 0xa0, 0xe6, 0xce, 0xd8, 0x78, - 0xf2, 0x92, 0xe8, 0xf2, 0x3c, 0x1b, 0x4d, 0xdc, 0x29, 0x23, 0x55, 0x89, 0x7d, 0xc9, 0x8e, 0xce, - 0x5e, 0x11, 0x43, 0xaa, 0xd1, 0xcd, 0x25, 0x35, 0x5a, 0x87, 0xea, 0x78, 0x32, 0x73, 0x89, 0x49, - 0x6d, 0x30, 0x95, 0xa3, 0x4b, 0xea, 0x52, 0x50, 0x9e, 0x2e, 0xb1, 0x24, 0x1e, 0x5d, 0x5d, 0x02, - 0x9d, 0x77, 0xd0, 0x7a, 0xeb, 0x5f, 0x2d, 0xf8, 0x38, 0x9e, 0x27, 0x9f, 0x26, 0xcf, 0x5e, 0xd1, - 0xf9, 0x0a, 0x56, 0xfe, 0x4e, 0x51, 0x8d, 0xeb, 0x54, 0x35, 0xbd, 0x68, 0xf3, 0x26, 0x7b, 0xf4, - 0x2d, 0xf6, 0x74, 0xfe, 0xd5, 0xc0, 0x9a, 0x24, 0x41, 0x41, 0xd1, 0xbb, 0x60, 0x84, 0x71, 0xba, - 0x10, 0x8e, 0xd6, 0xd6, 0xbb, 0x16, 0x53, 0x82, 0x6c, 0x5f, 0xb2, 0x10, 0x52, 0x5d, 0x41, 0x75, - 0x21, 0x2d, 0x73, 0xd2, 0xd7, 0x72, 0xfa, 0x1c, 0xcc, 0x24, 0xf5, 0x30, 0xad, 0x2a, 0xaa, 0x6b, - 0x49, 0x8a, 0x45, 0xdd, 0x85, 0x5a, 0x90, 0x44, 0x7e, 0x18, 0x3b, 0xa6, 0xd2, 0x2b, 0x89, 0xf6, - 0xc1, 0xf2, 0xcb, 0xea, 0x3b, 0x06, 0xf6, 0xea, 0xee, 0x4d, 0x1c, 0x66, 0x2b, 0xd8, 0xd6, 0x9d, - 0x6a, 0xdb, 0x77, 0xfa, 0x4d, 0x07, 0x78, 0x9d, 0x04, 0xfc, 0x4a, 0x5d, 0xea, 0x21, 0x40, 0x98, - 0x79, 0xef, 0x79, 0x96, 0x87, 0x49, 0x8c, 0x05, 0xd4, 0x99, 0x15, 0x66, 0x6f, 0x95, 0x82, 0xfe, - 0x00, 0x8d, 0x24, 0xcd, 0xb9, 0xf0, 0xc2, 0x28, 0x4d, 0x32, 0x81, 0x64, 0xb4, 0xfb, 0x8e, 0xca, - 0x61, 0x9a, 0xf2, 0xcc, 0x17, 0x49, 0xe6, 0x72, 0x31, 0x0e, 0x54, 0x1e, 0x36, 0xa2, 0xc7, 0x08, - 0xa6, 0x7b, 0xd0, 0x4c, 0xb3, 0x24, 0x58, 0x5c, 0xf0, 0x62, 0x7e, 0x2b, 0x98, 0x4c, 0xa3, 0x54, - 0xe2, 0x00, 0x7f, 0x03, 0x64, 0x09, 0x2a, 0xd3, 0x50, 0x35, 0xbb, 0x53, 0xea, 0xcb, 0x64, 0x56, - 0x55, 0xaa, 0x6e, 0x54, 0x69, 0x0f, 0x9a, 0x91, 0xbc, 0xd1, 0xd2, 0xdf, 0xc0, 0x6b, 0x34, 0x50, - 0x59, 0x3a, 0xdf, 0x5e, 0x16, 0xfa, 0x35, 0x18, 0x48, 0x79, 0x6c, 0xc0, 0x4d, 0x13, 0xa1, 0xcc, - 0xf4, 0x39, 0xb4, 0x22, 0x2e, 0xfc, 0xc0, 0x17, 0xbe, 0x97, 0x66, 0x49, 0x9a, 0x3b, 0x2d, 0x2c, - 0xc9, 0x97, 0xca, 0x41, 0x45, 0x53, 0xbf, 0xa3, 0x58, 0x64, 0xd7, 0xca, 0xb9, 0x59, 0xfa, 0x9c, - 0x49, 0x97, 0xce, 0x8f, 0xb0, 0x7b, 0x33, 0x90, 0x12, 0xd0, 0x7f, 0xe6, 0xd7, 0x05, 0x91, 0xe5, - 0x51, 0xb2, 0xee, 0xbd, 0x64, 0x7b, 0x51, 0x3c, 0x25, 0x74, 0xfe, 0xac, 0x00, 0xac, 0x92, 0x93, - 0x64, 0x8f, 0x93, 0x80, 0x23, 0x33, 0x97, 0x64, 0x5f, 0x32, 0x97, 0xa1, 0x71, 0xc9, 0xc8, 0xca, - 0x1a, 0x23, 0x07, 0x60, 0x87, 0x71, 0x28, 0x42, 0xff, 0x2a, 0xfc, 0x95, 0x67, 0x05, 0xc5, 0x6e, - 0x78, 0x3a, 0xd6, 0x51, 0x5b, 0xa5, 0x84, 0xed, 0x52, 0x3e, 0x29, 0xe7, 0xc4, 0x5e, 0x27, 0xec, - 0xe6, 0xc8, 0x96, 0xd3, 0xf3, 0x74, 0x39, 0x3d, 0x8d, 0x5b, 0xc0, 0xe5, 0x4c, 0x0d, 0x00, 0xf0, - 0xfa, 0x5e, 0x18, 0xcf, 0x13, 0xa7, 0x79, 0x8b, 0x87, 0xf5, 0xbe, 0x94, 0x3b, 0x7f, 0x18, 0x60, - 0xaf, 0x5d, 0x45, 0x96, 0x21, 0x08, 0xa3, 0x1c, 0x6b, 0xa5, 0x33, 0x3c, 0xd3, 0x2f, 0xc0, 0xc2, - 0x8e, 0x2e, 0x5f, 0x0c, 0x83, 0xd5, 0xa5, 0x02, 0x87, 0x73, 0x00, 0x66, 0xce, 0x2f, 0x23, 0x1e, - 0x0b, 0x24, 0xa6, 0xdd, 0xbf, 0xff, 0x51, 0x7d, 0xf6, 0x5d, 0x05, 0x60, 0x25, 0x92, 0x7e, 0x05, - 0x80, 0xef, 0xb8, 0x27, 0xc3, 0x38, 0x55, 0xf9, 0xb2, 0x1f, 0x57, 0x88, 0xc6, 0x2c, 0xd4, 0x9e, - 0xf8, 0xc2, 0x97, 0x90, 0x30, 0x16, 0x83, 0xbe, 0x82, 0xc8, 0xd2, 0x1b, 0x0a, 0x82, 0x5a, 0x84, - 0x3c, 0x06, 0x5b, 0x55, 0x59, 0x61, 0x6a, 0xf8, 0xe6, 0x83, 0x52, 0xad, 0xc5, 0x18, 0x1e, 0x2a, - 0xbb, 0x5c, 0x20, 0xfa, 0x32, 0xc6, 0xf0, 0x10, 0x21, 0x65, 0xdb, 0xeb, 0x6b, 0x6d, 0xdf, 0xec, - 0x60, 0x63, 0xbb, 0x83, 0xf7, 0xa1, 0x9e, 0xf9, 0x1f, 0x54, 0x4c, 0x0b, 0x17, 0x9d, 0x99, 0xf9, - 0x1f, 0x30, 0xda, 0x1e, 0xd8, 0x41, 0xb2, 0x38, 0xbf, 0xe2, 0xca, 0x2a, 0x77, 0x8d, 0x86, 0x5f, - 0x04, 0xa5, 0x2e, 0x41, 0x8b, 0xb5, 0xb4, 0x24, 0x0f, 0xaa, 0x0a, 0xb4, 0x58, 0xe6, 0xf5, 0xa0, - 0x07, 0x66, 0x51, 0x35, 0xc9, 0xf1, 0x73, 0x7e, 0x19, 0x96, 0xef, 0x8f, 0x12, 0xe4, 0x2c, 0xf0, - 0x38, 0xc0, 0x76, 0xe8, 0x4c, 0x1e, 0x3b, 0xff, 0x69, 0x50, 0x3f, 0x29, 0xdb, 0xf2, 0xe9, 0x45, - 0x64, 0x81, 0xf1, 0x66, 0x3c, 0x99, 0x3d, 0x23, 0x95, 0x62, 0xb7, 0x3c, 0x53, 0x8b, 0x48, 0x2a, - 0x7b, 0x43, 0xb5, 0x88, 0xd4, 0xd1, 0x28, 0x8e, 0x83, 0x3e, 0xa9, 0x15, 0xc7, 0xe1, 0x21, 0x31, - 0xd7, 0x36, 0x58, 0x5d, 0x86, 0x38, 0x9e, 0x4e, 0x4f, 0x89, 0x25, 0x37, 0x12, 0x7e, 0xa2, 0x37, - 0x24, 0x20, 0x21, 0x27, 0xd3, 0x37, 0xc7, 0xa7, 0x23, 0x62, 0x97, 0xb1, 0x07, 0x7d, 0xd2, 0x28, - 0xcf, 0xc3, 0x43, 0xd2, 0x94, 0x29, 0x3e, 0x9f, 0xbe, 0x3e, 0x3b, 0x1d, 0xfd, 0x34, 0x3c, 0x24, - 0x2d, 0xda, 0x02, 0x28, 0xc4, 0x5e, 0xff, 0x19, 0xb9, 0x43, 0x1b, 0x50, 0x3f, 0x2e, 0x03, 0x92, - 0xce, 0x5f, 0x1a, 0x10, 0x45, 0x29, 0xf7, 0x9d, 0x5f, 0xac, 0x29, 0xda, 0x07, 0x3d, 0x08, 0xa3, - 0x62, 0xae, 0xdb, 0xeb, 0xbc, 0x5b, 0x81, 0xf6, 0x4f, 0xc2, 0x88, 0xc7, 0xf2, 0x91, 0x63, 0x12, - 0xfc, 0x20, 0x03, 0x6b, 0xa9, 0xa1, 0x0f, 0xc1, 0x0a, 0xc2, 0xc8, 0x53, 0x4f, 0x08, 0x96, 0xf7, - 0xd5, 0x0e, 0xab, 0x07, 0x61, 0x84, 0x03, 0x53, 0x9a, 0x53, 0x3f, 0xf3, 0x23, 0xf5, 0x30, 0x14, - 0xe6, 0x33, 0xa9, 0xa1, 0x8f, 0x00, 0x02, 0x1e, 0x27, 0xc2, 0x17, 0xab, 0x67, 0x79, 0x4d, 0x73, - 0x6c, 0x16, 0x8f, 0x53, 0xe7, 0x1f, 0x0d, 0xac, 0xe5, 0x72, 0xa5, 0xdf, 0x83, 0xad, 0xfe, 0x6a, - 0xa8, 0x81, 0xd2, 0x70, 0x6a, 0x76, 0xb7, 0x56, 0x70, 0x71, 0x8f, 0x57, 0x3b, 0x0c, 0x14, 0x18, - 0xbb, 0xba, 0xf9, 0xc5, 0xda, 0xf6, 0x17, 0x1f, 0xb8, 0x50, 0x53, 0x7e, 0x72, 0x66, 0xf9, 0x15, - 0x8f, 0x56, 0x9f, 0x30, 0x58, 0x5d, 0x2a, 0x30, 0xcc, 0x53, 0x30, 0x72, 0x59, 0xa0, 0x62, 0xfd, - 0xef, 0xde, 0x5c, 0x39, 0xa6, 0x40, 0xab, 0x6b, 0xbc, 0x00, 0xfa, 0xf1, 0x52, 0x5b, 0xdb, 0x3b, - 0xda, 0xc6, 0xde, 0x71, 0xc0, 0x2c, 0x37, 0x8e, 0x22, 0x69, 0x29, 0x3e, 0xb9, 0x00, 0xb3, 0xdc, - 0x3b, 0x14, 0x5a, 0x9e, 0x3b, 0x3b, 0x62, 0x33, 0xef, 0xed, 0x88, 0xb9, 0xe3, 0xe9, 0x84, 0xec, - 0xd0, 0xfb, 0x70, 0x6f, 0xcc, 0x4a, 0xd9, 0xeb, 0x1f, 0xf4, 0xbe, 0xf3, 0x7a, 0x07, 0x5e, 0xef, - 0x80, 0x68, 0x9f, 0x30, 0x0d, 0x0e, 0x48, 0x45, 0xd2, 0x67, 0x65, 0x22, 0xfa, 0x79, 0x4d, 0xfd, - 0xa7, 0xfe, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xe5, 0x94, 0x6a, 0xc8, 0x61, 0x0b, 0x00, 0x00, + // 1754 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0x4f, 0x6f, 0xdb, 0xc8, + 0x15, 0x17, 0x45, 0x49, 0x14, 0x9f, 0xfe, 0x64, 0x32, 0xcd, 0x3a, 0x8c, 0x77, 0xe3, 0xa8, 0x32, + 0x50, 0x28, 0xdb, 0xc0, 0xb0, 0x24, 0xc3, 0xf5, 0xa2, 0x45, 0x5b, 0x39, 0x96, 0x63, 0x01, 0x8e, + 0x64, 0x0c, 0xe5, 0x60, 0x2f, 0x05, 0xc1, 0x98, 0x63, 0x87, 0x88, 0x45, 0x72, 0x49, 0x2a, 0xbb, + 0xde, 0x4b, 0xd1, 0x6f, 0x50, 0xf4, 0x9b, 0xf4, 0x56, 0xf4, 0x56, 0xf4, 0xd2, 0xe3, 0xf6, 0xb6, + 0xe8, 0x69, 0x91, 0x7c, 0x91, 0x62, 0xde, 0x90, 0x14, 0x25, 0xcb, 0x6e, 0x2f, 0xc2, 0xbc, 0xf7, + 0x7e, 0xf3, 0x38, 0xef, 0xff, 0x13, 0xd4, 0x7c, 0xcf, 0xfb, 0x6e, 0x27, 0x08, 0xfd, 0xd8, 0xef, + 0xd3, 0x92, 0x20, 0xda, 0x3f, 0x95, 0xa1, 0x39, 0x88, 0xe3, 0xd0, 0x7d, 0x3b, 0x8f, 0xf9, 0x99, + 0x90, 0x50, 0x0a, 0x25, 0xcf, 0x9e, 0x71, 0x43, 0x69, 0x29, 0x1d, 0x9d, 0xe1, 0x99, 0xb6, 0xa1, + 0x11, 0xf2, 0x4b, 0xcb, 0x8e, 0xe3, 0xd0, 0x42, 0xe1, 0x67, 0x28, 0xac, 0x85, 0xfc, 0x52, 0xdc, + 0x1e, 0x0b, 0xcc, 0x53, 0x00, 0xc7, 0xbf, 0xb0, 0xa2, 0x38, 0x74, 0xbd, 0x2b, 0xa3, 0x81, 0x00, + 0xdd, 0xf1, 0x2f, 0x4c, 0x64, 0xd0, 0x7d, 0x28, 0xc5, 0x37, 0x01, 0x37, 0x1e, 0xb5, 0x94, 0x4e, + 0xb3, 0xd7, 0xde, 0xc1, 0xb7, 0x2c, 0x7f, 0x7a, 0x41, 0x4e, 0x6f, 0x02, 0xce, 0x10, 0x4f, 0xeb, + 0xa0, 0x5c, 0x1a, 0xc5, 0x96, 0xd2, 0x29, 0x32, 0xe5, 0x52, 0x50, 0xae, 0xa1, 0xb6, 0x94, 0x8e, + 0xca, 0x14, 0x57, 0x50, 0x91, 0x51, 0x6a, 0x29, 0x9d, 0x3a, 0x53, 0x22, 0xfa, 0x0c, 0x94, 0xd8, + 0x28, 0xb7, 0x94, 0x4e, 0xad, 0xf7, 0x50, 0xaa, 0x9f, 0x72, 0x2f, 0xf2, 0x43, 0xd4, 0xcd, 0x94, + 0x98, 0x6e, 0x81, 0x72, 0x65, 0x54, 0x10, 0x40, 0x24, 0xe0, 0x55, 0x68, 0x07, 0xef, 0x12, 0xf9, + 0x15, 0xfd, 0x0d, 0x34, 0xa2, 0xc0, 0x0e, 0x23, 0x6e, 0xc5, 0x78, 0xd1, 0xd8, 0x40, 0xec, 0x63, + 0x89, 0x35, 0x51, 0x94, 0x57, 0x59, 0x8f, 0x72, 0x2c, 0xba, 0x01, 0x95, 0xcb, 0x6b, 0xdf, 0x8e, + 0x23, 0x43, 0x6b, 0xa9, 0x9d, 0x22, 0x4b, 0x28, 0xe1, 0x4f, 0xd7, 0x8b, 0x23, 0xa3, 0xda, 0x52, + 0x3b, 0x2a, 0xc3, 0x33, 0x35, 0x40, 0x93, 0x7e, 0x8a, 0x0c, 0xbd, 0xa5, 0x76, 0xea, 0x2c, 0x25, + 0xe9, 0x2f, 0x41, 0x93, 0x1f, 0x8f, 0x0c, 0x68, 0xa9, 0xeb, 0x4d, 0x49, 0x11, 0xb4, 0x03, 0x95, + 0x2b, 0x61, 0x41, 0x64, 0xd4, 0x10, 0x7b, 0xdb, 0xaa, 0x44, 0x4e, 0x7f, 0x0b, 0xcd, 0x25, 0xd3, + 0x22, 0xe3, 0x31, 0xde, 0xb8, 0xd3, 0xb6, 0x46, 0xde, 0xb6, 0xa8, 0xfd, 0x37, 0x05, 0x1a, 0x4b, + 0xd1, 0xa1, 0x0d, 0xd0, 0xcf, 0xc7, 0x47, 0xc3, 0xe3, 0xd1, 0x78, 0x78, 0x44, 0x0a, 0x54, 0x87, + 0xf2, 0xf1, 0xe9, 0x64, 0x30, 0x25, 0x0a, 0xd5, 0x40, 0x1d, 0x8d, 0xa7, 0xa4, 0x48, 0x01, 0x2a, + 0xe6, 0x94, 0x8d, 0xc6, 0xaf, 0x88, 0x2a, 0xce, 0xd3, 0xe1, 0xd8, 0x9c, 0x30, 0x52, 0x12, 0xd8, + 0x57, 0x6c, 0x70, 0x76, 0x42, 0xca, 0xf4, 0x21, 0x34, 0xcc, 0xb3, 0x01, 0x33, 0x87, 0x56, 0x22, + 0xad, 0x09, 0x24, 0x6a, 0x32, 0x49, 0x85, 0x56, 0xa1, 0x34, 0x1a, 0x4f, 0x4d, 0xa2, 0xd1, 0x1a, + 0x68, 0x52, 0x97, 0x49, 0xaa, 0x82, 0x90, 0x70, 0x93, 0xe8, 0x02, 0x8f, 0xda, 0x4c, 0x02, 0x94, + 0x42, 0x73, 0x49, 0x9d, 0x49, 0xea, 0xed, 0x77, 0xd0, 0x7c, 0x63, 0x5f, 0xcf, 0xf9, 0xc8, 0xbb, + 0xf4, 0xef, 0xce, 0xf0, 0xed, 0x24, 0x3d, 0x8b, 0x18, 0xf2, 0x07, 0x89, 0xd3, 0x6f, 0x02, 0x99, + 0x99, 0x49, 0x2e, 0x2e, 0xa7, 0xb8, 0xba, 0x92, 0xe2, 0xed, 0x7f, 0x2b, 0xa0, 0x8f, 0x7d, 0x27, + 0xa9, 0xa3, 0x47, 0x50, 0x76, 0xbd, 0x60, 0x1e, 0x1b, 0x4a, 0x4b, 0xed, 0xe8, 0x4c, 0x12, 0x22, + 0x4b, 0xfc, 0x79, 0x2c, 0xd8, 0x45, 0x64, 0x27, 0x54, 0xf6, 0x26, 0x35, 0xf7, 0xa6, 0xc7, 0xa0, + 0xf9, 0x81, 0x85, 0xcf, 0x2a, 0x21, 0xbb, 0xe2, 0x07, 0xe8, 0xfb, 0x0d, 0xa8, 0x38, 0xfe, 0xcc, + 0x76, 0x3d, 0x43, 0x93, 0x7c, 0x49, 0xd1, 0x1e, 0xe8, 0x76, 0x1a, 0x24, 0xa3, 0x8c, 0x01, 0x7e, + 0xb4, 0xae, 0xd0, 0xd8, 0x02, 0xb6, 0x62, 0x53, 0x65, 0xd5, 0xa6, 0x3f, 0xa9, 0x00, 0xaf, 0x7d, + 0x87, 0x5f, 0x4b, 0xa3, 0x9e, 0x02, 0xb8, 0xa1, 0xf5, 0x81, 0x87, 0x91, 0xeb, 0x7b, 0xe8, 0x40, + 0x95, 0xe9, 0x6e, 0xf8, 0x46, 0x32, 0xe8, 0xaf, 0xa1, 0xee, 0x07, 0x11, 0x8f, 0x2d, 0x77, 0x16, + 0xf8, 0x61, 0x8c, 0x39, 0x5f, 0xeb, 0x19, 0xf2, 0x0d, 0x93, 0x80, 0x87, 0x76, 0xec, 0x87, 0x26, + 0x8f, 0x47, 0x8e, 0x7c, 0x47, 0x0d, 0xd1, 0x23, 0x04, 0xd3, 0x6d, 0x68, 0x04, 0xa1, 0xef, 0xcc, + 0x2f, 0x78, 0xd2, 0x64, 0x8a, 0xf8, 0x98, 0x7a, 0xca, 0xc4, 0x2e, 0xf3, 0x1c, 0x48, 0x06, 0x4a, + 0x9f, 0x21, 0x7d, 0xf6, 0x20, 0xe5, 0xa7, 0x8f, 0x59, 0x78, 0xa9, 0xb4, 0xe4, 0xa5, 0x6d, 0x68, + 0xcc, 0x84, 0x45, 0xd9, 0xfd, 0x32, 0x9a, 0x51, 0x47, 0x66, 0x7a, 0xf9, 0x7e, 0xb7, 0xd0, 0x5f, + 0x40, 0x19, 0x2b, 0x0b, 0x03, 0xb0, 0xae, 0xf0, 0xa4, 0x98, 0xbe, 0x84, 0xe6, 0x8c, 0xc7, 0xb6, + 0x63, 0xc7, 0xb6, 0x15, 0x84, 0x7e, 0x10, 0x19, 0x4d, 0x74, 0xc9, 0x17, 0x49, 0xdd, 0xa1, 0x36, + 0xf9, 0x3b, 0xf4, 0xe2, 0xf0, 0x26, 0x29, 0xbe, 0xf4, 0xce, 0x99, 0xb8, 0xd2, 0xfe, 0x3d, 0x6c, + 0xac, 0x07, 0x52, 0x02, 0xea, 0x7b, 0x7e, 0x93, 0x24, 0xb2, 0x38, 0x8a, 0xac, 0xfb, 0x20, 0xb2, + 0x3d, 0x71, 0x9e, 0x24, 0xda, 0x7f, 0x51, 0x80, 0xc8, 0x52, 0x1e, 0x78, 0x9e, 0x1f, 0xdb, 0xb1, + 0x30, 0xf1, 0x19, 0xd4, 0x64, 0x33, 0xb0, 0x72, 0xd5, 0x00, 0x92, 0x85, 0xbe, 0xfe, 0x03, 0x7c, + 0xf1, 0xcd, 0xdc, 0xf6, 0x62, 0x2b, 0xb0, 0x43, 0x7b, 0xc6, 0x63, 0x1e, 0x5a, 0xb9, 0x0b, 0x11, + 0x66, 0xf0, 0xff, 0x32, 0xe5, 0x09, 0x6a, 0x38, 0x4b, 0x15, 0x4c, 0x33, 0xed, 0x51, 0xfb, 0x1f, + 0x2a, 0xc0, 0xc2, 0x63, 0xa2, 0x02, 0x3d, 0xdf, 0xe1, 0x58, 0x2e, 0x59, 0x05, 0x66, 0xe5, 0xc4, + 0x50, 0x98, 0x95, 0x49, 0x31, 0x57, 0x26, 0x7d, 0xa8, 0xb9, 0x9e, 0x1b, 0xbb, 0xf6, 0xb5, 0xfb, + 0x3d, 0x0f, 0x93, 0xbc, 0x5f, 0xd3, 0x36, 0xf3, 0x28, 0x7a, 0x0c, 0x34, 0x69, 0x88, 0xf9, 0xbb, + 0x0f, 0xee, 0x6f, 0x8a, 0x0f, 0xe5, 0x95, 0x51, 0x4e, 0xcf, 0x72, 0x9e, 0xc0, 0x6a, 0x9e, 0x7c, + 0x99, 0x36, 0x81, 0x5a, 0xbe, 0x1a, 0x97, 0xfb, 0x51, 0xda, 0x1a, 0x5e, 0x64, 0xad, 0xa1, 0x7e, + 0x0f, 0x38, 0x6d, 0x18, 0x7d, 0x00, 0x8c, 0xad, 0xe5, 0x7a, 0x97, 0xbe, 0xd1, 0xb8, 0xe7, 0x86, + 0xfe, 0x21, 0xa5, 0xe9, 0x04, 0x1e, 0x63, 0x3c, 0xdc, 0xef, 0x31, 0x05, 0x2c, 0x3b, 0xcb, 0x86, + 0x24, 0x2f, 0x37, 0xf2, 0x6e, 0x5b, 0xe4, 0x0a, 0xdb, 0xc8, 0x5f, 0x5b, 0xf0, 0xdb, 0x3f, 0x56, + 0xa0, 0x96, 0xf3, 0x90, 0x88, 0x8f, 0xe3, 0xce, 0x22, 0x0c, 0xa2, 0xca, 0xf0, 0x4c, 0x3f, 0x07, + 0x1d, 0xf3, 0x3f, 0xeb, 0xaf, 0x65, 0x56, 0x15, 0x0c, 0x6c, 0x65, 0x7d, 0xd0, 0x22, 0x7e, 0x35, + 0xe3, 0x5e, 0x8c, 0x65, 0x5c, 0xeb, 0x3d, 0xb9, 0x15, 0xb8, 0x1d, 0x53, 0x02, 0x58, 0x8a, 0xa4, + 0x3f, 0x07, 0xc0, 0xe1, 0x6a, 0x09, 0x35, 0x46, 0x49, 0x8c, 0xdb, 0xc3, 0x22, 0x51, 0x98, 0x8e, + 0xdc, 0x23, 0x3b, 0xb6, 0x05, 0xc4, 0xf5, 0xe2, 0x7e, 0x4f, 0x42, 0x44, 0x4e, 0x94, 0x25, 0x04, + 0xb9, 0x08, 0x79, 0x06, 0x35, 0x19, 0x36, 0x89, 0xa9, 0xe0, 0x20, 0x06, 0xc9, 0xca, 0xe9, 0xd8, + 0xdf, 0x93, 0x72, 0x31, 0xd5, 0xd5, 0x4c, 0xc7, 0xfe, 0x1e, 0x42, 0xd2, 0x7c, 0xac, 0xe6, 0xf2, + 0x71, 0x39, 0x25, 0xea, 0xab, 0x29, 0xf1, 0x04, 0xaa, 0xa1, 0xfd, 0xad, 0xd4, 0xa9, 0xe3, 0xee, + 0xa2, 0x85, 0xf6, 0xb7, 0xa8, 0x6d, 0x00, 0x0d, 0xfe, 0x5d, 0xcc, 0x43, 0xcf, 0xbe, 0x96, 0xf2, + 0xc6, 0xff, 0x51, 0x61, 0xf5, 0xf4, 0x0a, 0xaa, 0x78, 0x09, 0x0d, 0x74, 0xf6, 0xb5, 0x7f, 0x91, + 0xc6, 0x55, 0xec, 0x5b, 0x5b, 0xb7, 0xbd, 0x2a, 0xe0, 0xa7, 0x09, 0x8a, 0xd5, 0x9d, 0x1c, 0x45, + 0xb7, 0xa1, 0xe6, 0xf8, 0xf3, 0xb7, 0xd7, 0x5c, 0xbe, 0x42, 0x2c, 0x22, 0x0a, 0x5a, 0x0e, 0x92, + 0x8d, 0x5f, 0xda, 0x86, 0xda, 0x3c, 0xe7, 0x1e, 0x91, 0xe0, 0x25, 0x09, 0x9a, 0x67, 0xfe, 0xd9, + 0xec, 0x82, 0x96, 0x44, 0x4f, 0x74, 0xa6, 0xb7, 0xfc, 0xca, 0x4d, 0xa7, 0x86, 0x24, 0x44, 0x07, + 0xe3, 0x9e, 0x83, 0x69, 0xa1, 0x32, 0x71, 0x6c, 0xff, 0x47, 0x81, 0xea, 0x51, 0x9a, 0x1e, 0x77, + 0x6f, 0x19, 0x3a, 0x94, 0xcf, 0x47, 0xe3, 0xe9, 0x01, 0x29, 0x26, 0x5b, 0xc2, 0x81, 0xdc, 0x32, + 0x04, 0xb3, 0xbb, 0x2f, 0xb7, 0x0c, 0x79, 0x2c, 0x27, 0xc7, 0x7e, 0x8f, 0x54, 0x92, 0xe3, 0xfe, + 0x1e, 0xd1, 0x72, 0xeb, 0x49, 0x55, 0xa8, 0x38, 0x9c, 0x4c, 0x4e, 0x89, 0x2e, 0x76, 0x0b, 0xfc, + 0x44, 0x77, 0x9f, 0x80, 0x80, 0x1c, 0x4d, 0xce, 0x0f, 0x4f, 0x87, 0x72, 0x2f, 0x39, 0x97, 0x5a, + 0xea, 0xe9, 0x79, 0x7f, 0x8f, 0x34, 0xc4, 0x13, 0x5f, 0x4e, 0x5e, 0x9f, 0x9d, 0x0e, 0xbf, 0xde, + 0xdf, 0x23, 0x4d, 0xda, 0x04, 0x48, 0xc8, 0x6e, 0xef, 0x80, 0x3c, 0xa0, 0x75, 0xa8, 0x1e, 0xa6, + 0x0a, 0x49, 0xfb, 0x39, 0xd4, 0xf3, 0x7e, 0x17, 0x5f, 0x3b, 0x1a, 0x1e, 0x0f, 0xce, 0x4f, 0xa7, + 0xa4, 0x20, 0xa0, 0xc3, 0xaf, 0xa7, 0x43, 0x36, 0x1e, 0x9c, 0x12, 0xa5, 0xfd, 0x47, 0x78, 0x78, + 0xab, 0x03, 0xd1, 0xe7, 0x50, 0xc1, 0x6a, 0x8e, 0xd0, 0x8b, 0x6b, 0xdb, 0x5c, 0x02, 0x10, 0x9b, + 0xa4, 0xeb, 0x39, 0xee, 0x05, 0x36, 0xea, 0x3b, 0xb0, 0x29, 0x22, 0xab, 0x5b, 0x75, 0x51, 0xb7, + 0xed, 0xbf, 0x67, 0x43, 0xc3, 0x7c, 0x67, 0x27, 0x8b, 0x10, 0xed, 0x81, 0xea, 0xb8, 0xb3, 0xa4, + 0x49, 0xb7, 0xf2, 0x1a, 0x17, 0xa0, 0x9d, 0x23, 0x77, 0xc6, 0x3d, 0x31, 0x46, 0x99, 0x00, 0x6f, + 0x86, 0xa0, 0x67, 0x1c, 0xfa, 0x14, 0x74, 0xc7, 0x9d, 0x59, 0x72, 0x48, 0x61, 0x2a, 0x9c, 0x14, + 0x58, 0xd5, 0x71, 0x67, 0xd8, 0xb5, 0x52, 0x31, 0x4e, 0x1c, 0xd9, 0xe5, 0x13, 0x31, 0x8e, 0x10, + 0xba, 0x05, 0xe0, 0xf0, 0xac, 0x67, 0xc9, 0xc1, 0x9f, 0xe3, 0x1c, 0x6a, 0xc9, 0xf8, 0x6b, 0xff, + 0x53, 0x05, 0x3d, 0x5b, 0xdf, 0xe8, 0x57, 0xd9, 0xa8, 0xc3, 0x26, 0x24, 0x7d, 0xb7, 0xb1, 0xb2, + 0xe4, 0x25, 0x76, 0x9c, 0x14, 0xd2, 0x21, 0x88, 0x19, 0xf8, 0x3b, 0x68, 0x44, 0xfc, 0x9b, 0x39, + 0xf7, 0x2e, 0xf8, 0x62, 0x15, 0xcb, 0x76, 0x9a, 0xc5, 0x65, 0x33, 0x01, 0x9d, 0x14, 0x58, 0x3d, + 0xbd, 0x80, 0x0a, 0x76, 0xa1, 0x3a, 0xb3, 0x93, 0x35, 0x4e, 0xfe, 0x3b, 0xf9, 0xd9, 0xea, 0xdd, + 0xd7, 0x76, 0x70, 0x52, 0x60, 0xda, 0xcc, 0x96, 0xeb, 0xdd, 0xb2, 0x91, 0x95, 0x55, 0x23, 0x37, + 0x4d, 0xa8, 0x24, 0xff, 0x39, 0x3e, 0x07, 0x9d, 0x5f, 0xf3, 0xd9, 0xc2, 0xaa, 0x32, 0xab, 0x0a, + 0x06, 0xaa, 0x79, 0x01, 0xe5, 0x48, 0xc4, 0x24, 0x09, 0xff, 0xc6, 0xfa, 0x60, 0x31, 0x09, 0xda, + 0x3c, 0x80, 0x6a, 0x6a, 0x02, 0x7d, 0xb1, 0xaa, 0x76, 0xcd, 0x46, 0x9c, 0x7d, 0x67, 0xf3, 0x0c, + 0xd4, 0xd7, 0x76, 0x20, 0xfa, 0xda, 0x7b, 0x7e, 0x93, 0x7f, 0x8a, 0xf6, 0x9e, 0xdf, 0xe0, 0x4b, + 0x76, 0xd2, 0x59, 0x75, 0xdf, 0x8a, 0x2d, 0xc7, 0x94, 0xa0, 0x17, 0x51, 0x3c, 0x06, 0x7a, 0x7b, + 0x6b, 0xcc, 0x2d, 0x76, 0xca, 0xd2, 0x62, 0x67, 0x80, 0x96, 0xae, 0x74, 0xb2, 0x9f, 0xa4, 0xe4, + 0x97, 0x7f, 0x55, 0x40, 0x4b, 0x37, 0x3b, 0x0a, 0x4d, 0xcb, 0x9c, 0x0e, 0xd8, 0xd4, 0x7a, 0x33, + 0x64, 0xe6, 0x68, 0x32, 0x26, 0x05, 0xfa, 0x04, 0x3e, 0x1b, 0xb1, 0x94, 0xb6, 0x7a, 0xbb, 0xdd, + 0x5f, 0x59, 0xdd, 0x5d, 0xab, 0xbb, 0x4b, 0x94, 0x3b, 0x44, 0xfd, 0x5d, 0x52, 0xa4, 0x06, 0x3c, + 0xba, 0x25, 0xea, 0x5a, 0x7d, 0xa2, 0xde, 0x96, 0x7c, 0x65, 0x75, 0xad, 0x5e, 0x8f, 0x94, 0xd6, + 0x49, 0xfa, 0x56, 0xf7, 0x80, 0x94, 0x45, 0xe3, 0x58, 0x48, 0x48, 0xe5, 0xd0, 0xf8, 0xd7, 0xc7, + 0x2d, 0xe5, 0x87, 0x8f, 0x5b, 0xca, 0x4f, 0x1f, 0xb7, 0x94, 0x3f, 0x7f, 0xda, 0x2a, 0xfc, 0xf0, + 0x69, 0xab, 0xf0, 0xe3, 0xa7, 0xad, 0xc2, 0xdb, 0x8a, 0xfc, 0x0b, 0xff, 0xdf, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x43, 0xb6, 0x15, 0x62, 0xd0, 0x0f, 0x00, 0x00, +} + +func (m *AttributeProto) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AttributeProto) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.F != 0 { + dAtA[i] = 0x15 + i++ + encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(math.Float32bits(float32(m.F)))) + i += 4 + } + if m.I != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.I)) + } + if len(m.S) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.S))) + i += copy(dAtA[i:], m.S) + } + if m.T != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.T.Size())) + n1, err := m.T.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + if m.G != nil { + dAtA[i] = 0x32 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.G.Size())) + n2, err := m.G.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + if len(m.Floats) > 0 { + dAtA[i] = 0x3a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.Floats)*4)) + for _, num := range m.Floats { + f3 := math.Float32bits(float32(num)) + encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(f3)) + i += 4 + } + } + if len(m.Ints) > 0 { + dAtA5 := make([]byte, len(m.Ints)*10) + var j4 int + for _, num1 := range m.Ints { + num := uint64(num1) + for num >= 1<<7 { + dAtA5[j4] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j4++ + } + dAtA5[j4] = uint8(num) + j4++ + } + dAtA[i] = 0x42 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(j4)) + i += copy(dAtA[i:], dAtA5[:j4]) + } + if len(m.Strings) > 0 { + for _, b := range m.Strings { + dAtA[i] = 0x4a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(b))) + i += copy(dAtA[i:], b) + } + } + if len(m.Tensors) > 0 { + for _, msg := range m.Tensors { + dAtA[i] = 0x52 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Graphs) > 0 { + for _, msg := range m.Graphs { + dAtA[i] = 0x5a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.DocString) > 0 { + dAtA[i] = 0x6a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.DocString))) + i += copy(dAtA[i:], m.DocString) + } + if m.Type != 0 { + dAtA[i] = 0xa0 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.Type)) + } + if len(m.RefAttrName) > 0 { + dAtA[i] = 0xaa + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.RefAttrName))) + i += copy(dAtA[i:], m.RefAttrName) + } + if m.SparseTensor != nil { + dAtA[i] = 0xb2 + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.SparseTensor.Size())) + n6, err := m.SparseTensor.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + if len(m.SparseTensors) > 0 { + for _, msg := range m.SparseTensors { + dAtA[i] = 0xba + i++ + dAtA[i] = 0x1 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *ValueInfoProto) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ValueInfoProto) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Name) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if m.Type != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.Type.Size())) + n7, err := m.Type.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n7 + } + if len(m.DocString) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.DocString))) + i += copy(dAtA[i:], m.DocString) + } + return i, nil +} + +func (m *NodeProto) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeProto) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Input) > 0 { + for _, s := range m.Input { + dAtA[i] = 0xa + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.Output) > 0 { + for _, s := range m.Output { + dAtA[i] = 0x12 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.Name) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.OpType) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.OpType))) + i += copy(dAtA[i:], m.OpType) + } + if len(m.Attribute) > 0 { + for _, msg := range m.Attribute { + dAtA[i] = 0x2a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.DocString) > 0 { + dAtA[i] = 0x32 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.DocString))) + i += copy(dAtA[i:], m.DocString) + } + if len(m.Domain) > 0 { + dAtA[i] = 0x3a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.Domain))) + i += copy(dAtA[i:], m.Domain) + } + return i, nil +} + +func (m *ModelProto) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ModelProto) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.IrVersion != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.IrVersion)) + } + if len(m.ProducerName) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.ProducerName))) + i += copy(dAtA[i:], m.ProducerName) + } + if len(m.ProducerVersion) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.ProducerVersion))) + i += copy(dAtA[i:], m.ProducerVersion) + } + if len(m.Domain) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.Domain))) + i += copy(dAtA[i:], m.Domain) + } + if m.ModelVersion != 0 { + dAtA[i] = 0x28 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.ModelVersion)) + } + if len(m.DocString) > 0 { + dAtA[i] = 0x32 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.DocString))) + i += copy(dAtA[i:], m.DocString) + } + if m.Graph != nil { + dAtA[i] = 0x3a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.Graph.Size())) + n8, err := m.Graph.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n8 + } + if len(m.OpsetImport) > 0 { + for _, msg := range m.OpsetImport { + dAtA[i] = 0x42 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.MetadataProps) > 0 { + for _, msg := range m.MetadataProps { + dAtA[i] = 0x72 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *StringStringEntryProto) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *StringStringEntryProto) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Key) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + } + if len(m.Value) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + } + return i, nil +} + +func (m *TensorAnnotation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TensorAnnotation) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.TensorName) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.TensorName))) + i += copy(dAtA[i:], m.TensorName) + } + if len(m.QuantParameterTensorNames) > 0 { + for _, msg := range m.QuantParameterTensorNames { + dAtA[i] = 0x12 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil } + +func (m *GraphProto) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GraphProto) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Node) > 0 { + for _, msg := range m.Node { + dAtA[i] = 0xa + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Name) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Initializer) > 0 { + for _, msg := range m.Initializer { + dAtA[i] = 0x2a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.DocString) > 0 { + dAtA[i] = 0x52 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.DocString))) + i += copy(dAtA[i:], m.DocString) + } + if len(m.Input) > 0 { + for _, msg := range m.Input { + dAtA[i] = 0x5a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Output) > 0 { + for _, msg := range m.Output { + dAtA[i] = 0x62 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.ValueInfo) > 0 { + for _, msg := range m.ValueInfo { + dAtA[i] = 0x6a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.QuantizationAnnotation) > 0 { + for _, msg := range m.QuantizationAnnotation { + dAtA[i] = 0x72 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.SparseInitializer) > 0 { + for _, msg := range m.SparseInitializer { + dAtA[i] = 0x7a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *TensorProto) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TensorProto) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Dims) > 0 { + dAtA10 := make([]byte, len(m.Dims)*10) + var j9 int + for _, num1 := range m.Dims { + num := uint64(num1) + for num >= 1<<7 { + dAtA10[j9] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j9++ + } + dAtA10[j9] = uint8(num) + j9++ + } + dAtA[i] = 0xa + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(j9)) + i += copy(dAtA[i:], dAtA10[:j9]) + } + if m.DataType != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.DataType)) + } + if m.Segment != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.Segment.Size())) + n11, err := m.Segment.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n11 + } + if len(m.FloatData) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.FloatData)*4)) + for _, num := range m.FloatData { + f12 := math.Float32bits(float32(num)) + encoding_binary.LittleEndian.PutUint32(dAtA[i:], uint32(f12)) + i += 4 + } + } + if len(m.Int32Data) > 0 { + dAtA14 := make([]byte, len(m.Int32Data)*10) + var j13 int + for _, num1 := range m.Int32Data { + num := uint64(num1) + for num >= 1<<7 { + dAtA14[j13] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j13++ + } + dAtA14[j13] = uint8(num) + j13++ + } + dAtA[i] = 0x2a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(j13)) + i += copy(dAtA[i:], dAtA14[:j13]) + } + if len(m.StringData) > 0 { + for _, b := range m.StringData { + dAtA[i] = 0x32 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(b))) + i += copy(dAtA[i:], b) + } + } + if len(m.Int64Data) > 0 { + dAtA16 := make([]byte, len(m.Int64Data)*10) + var j15 int + for _, num1 := range m.Int64Data { + num := uint64(num1) + for num >= 1<<7 { + dAtA16[j15] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j15++ + } + dAtA16[j15] = uint8(num) + j15++ + } + dAtA[i] = 0x3a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(j15)) + i += copy(dAtA[i:], dAtA16[:j15]) + } + if len(m.Name) > 0 { + dAtA[i] = 0x42 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.RawData) > 0 { + dAtA[i] = 0x4a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.RawData))) + i += copy(dAtA[i:], m.RawData) + } + if len(m.DoubleData) > 0 { + dAtA[i] = 0x52 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.DoubleData)*8)) + for _, num := range m.DoubleData { + f17 := math.Float64bits(float64(num)) + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(f17)) + i += 8 + } + } + if len(m.Uint64Data) > 0 { + dAtA19 := make([]byte, len(m.Uint64Data)*10) + var j18 int + for _, num := range m.Uint64Data { + for num >= 1<<7 { + dAtA19[j18] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j18++ + } + dAtA19[j18] = uint8(num) + j18++ + } + dAtA[i] = 0x5a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(j18)) + i += copy(dAtA[i:], dAtA19[:j18]) + } + if len(m.DocString) > 0 { + dAtA[i] = 0x62 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.DocString))) + i += copy(dAtA[i:], m.DocString) + } + if len(m.ExternalData) > 0 { + for _, msg := range m.ExternalData { + dAtA[i] = 0x6a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.DataLocation != 0 { + dAtA[i] = 0x70 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.DataLocation)) + } + return i, nil +} + +func (m *TensorProto_Segment) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TensorProto_Segment) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Begin != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.Begin)) + } + if m.End != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.End)) + } + return i, nil +} + +func (m *SparseTensorProto) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SparseTensorProto) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Values != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.Values.Size())) + n20, err := m.Values.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n20 + } + if m.Indices != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.Indices.Size())) + n21, err := m.Indices.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n21 + } + if len(m.Dims) > 0 { + dAtA23 := make([]byte, len(m.Dims)*10) + var j22 int + for _, num1 := range m.Dims { + num := uint64(num1) + for num >= 1<<7 { + dAtA23[j22] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j22++ + } + dAtA23[j22] = uint8(num) + j22++ + } + dAtA[i] = 0x1a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(j22)) + i += copy(dAtA[i:], dAtA23[:j22]) + } + return i, nil +} + +func (m *TensorShapeProto) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TensorShapeProto) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Dim) > 0 { + for _, msg := range m.Dim { + dAtA[i] = 0xa + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *TensorShapeProto_Dimension) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TensorShapeProto_Dimension) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value != nil { + nn24, err := m.Value.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn24 + } + if len(m.Denotation) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.Denotation))) + i += copy(dAtA[i:], m.Denotation) + } + return i, nil +} + +func (m *TensorShapeProto_Dimension_DimValue) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x8 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.DimValue)) + return i, nil +} +func (m *TensorShapeProto_Dimension_DimParam) MarshalTo(dAtA []byte) (int, error) { + i := 0 + dAtA[i] = 0x12 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.DimParam))) + i += copy(dAtA[i:], m.DimParam) + return i, nil +} +func (m *TypeProto) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TypeProto) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Value != nil { + nn25, err := m.Value.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += nn25 + } + if len(m.Denotation) > 0 { + dAtA[i] = 0x32 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.Denotation))) + i += copy(dAtA[i:], m.Denotation) + } + return i, nil +} + +func (m *TypeProto_TensorType) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.TensorType != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.TensorType.Size())) + n26, err := m.TensorType.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n26 + } + return i, nil +} +func (m *TypeProto_SequenceType) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.SequenceType != nil { + dAtA[i] = 0x22 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.SequenceType.Size())) + n27, err := m.SequenceType.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n27 + } + return i, nil +} +func (m *TypeProto_MapType) MarshalTo(dAtA []byte) (int, error) { + i := 0 + if m.MapType != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.MapType.Size())) + n28, err := m.MapType.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n28 + } + return i, nil +} +func (m *TypeProto_Tensor) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TypeProto_Tensor) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.ElemType != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.ElemType)) + } + if m.Shape != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.Shape.Size())) + n29, err := m.Shape.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n29 + } + return i, nil +} + +func (m *TypeProto_Sequence) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TypeProto_Sequence) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.ElemType != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.ElemType.Size())) + n30, err := m.ElemType.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n30 + } + return i, nil +} + +func (m *TypeProto_Map) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TypeProto_Map) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.KeyType != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.KeyType)) + } + if m.ValueType != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.ValueType.Size())) + n31, err := m.ValueType.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n31 + } + return i, nil +} + +func (m *OperatorSetIdProto) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OperatorSetIdProto) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Domain) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(len(m.Domain))) + i += copy(dAtA[i:], m.Domain) + } + if m.Version != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintOnnx3(dAtA, i, uint64(m.Version)) + } + return i, nil +} + +func encodeVarintOnnx3(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *AttributeProto) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + if m.F != 0 { + n += 5 + } + if m.I != 0 { + n += 1 + sovOnnx3(uint64(m.I)) + } + l = len(m.S) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + if m.T != nil { + l = m.T.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + if m.G != nil { + l = m.G.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + if len(m.Floats) > 0 { + n += 1 + sovOnnx3(uint64(len(m.Floats)*4)) + len(m.Floats)*4 + } + if len(m.Ints) > 0 { + l = 0 + for _, e := range m.Ints { + l += sovOnnx3(uint64(e)) + } + n += 1 + sovOnnx3(uint64(l)) + l + } + if len(m.Strings) > 0 { + for _, b := range m.Strings { + l = len(b) + n += 1 + l + sovOnnx3(uint64(l)) + } + } + if len(m.Tensors) > 0 { + for _, e := range m.Tensors { + l = e.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + } + if len(m.Graphs) > 0 { + for _, e := range m.Graphs { + l = e.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + } + l = len(m.DocString) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + if m.Type != 0 { + n += 2 + sovOnnx3(uint64(m.Type)) + } + l = len(m.RefAttrName) + if l > 0 { + n += 2 + l + sovOnnx3(uint64(l)) + } + if m.SparseTensor != nil { + l = m.SparseTensor.Size() + n += 2 + l + sovOnnx3(uint64(l)) + } + if len(m.SparseTensors) > 0 { + for _, e := range m.SparseTensors { + l = e.Size() + n += 2 + l + sovOnnx3(uint64(l)) + } + } + return n +} + +func (m *ValueInfoProto) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + if m.Type != nil { + l = m.Type.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + l = len(m.DocString) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + return n +} + +func (m *NodeProto) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Input) > 0 { + for _, s := range m.Input { + l = len(s) + n += 1 + l + sovOnnx3(uint64(l)) + } + } + if len(m.Output) > 0 { + for _, s := range m.Output { + l = len(s) + n += 1 + l + sovOnnx3(uint64(l)) + } + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + l = len(m.OpType) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + if len(m.Attribute) > 0 { + for _, e := range m.Attribute { + l = e.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + } + l = len(m.DocString) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + l = len(m.Domain) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + return n +} + +func (m *ModelProto) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.IrVersion != 0 { + n += 1 + sovOnnx3(uint64(m.IrVersion)) + } + l = len(m.ProducerName) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + l = len(m.ProducerVersion) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + l = len(m.Domain) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + if m.ModelVersion != 0 { + n += 1 + sovOnnx3(uint64(m.ModelVersion)) + } + l = len(m.DocString) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + if m.Graph != nil { + l = m.Graph.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + if len(m.OpsetImport) > 0 { + for _, e := range m.OpsetImport { + l = e.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + } + if len(m.MetadataProps) > 0 { + for _, e := range m.MetadataProps { + l = e.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + } + return n +} + +func (m *StringStringEntryProto) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + l = len(m.Value) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + return n +} + +func (m *TensorAnnotation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TensorName) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + if len(m.QuantParameterTensorNames) > 0 { + for _, e := range m.QuantParameterTensorNames { + l = e.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + } + return n +} + +func (m *GraphProto) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Node) > 0 { + for _, e := range m.Node { + l = e.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + if len(m.Initializer) > 0 { + for _, e := range m.Initializer { + l = e.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + } + l = len(m.DocString) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + if len(m.Input) > 0 { + for _, e := range m.Input { + l = e.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + } + if len(m.Output) > 0 { + for _, e := range m.Output { + l = e.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + } + if len(m.ValueInfo) > 0 { + for _, e := range m.ValueInfo { + l = e.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + } + if len(m.QuantizationAnnotation) > 0 { + for _, e := range m.QuantizationAnnotation { + l = e.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + } + if len(m.SparseInitializer) > 0 { + for _, e := range m.SparseInitializer { + l = e.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + } + return n +} + +func (m *TensorProto) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Dims) > 0 { + l = 0 + for _, e := range m.Dims { + l += sovOnnx3(uint64(e)) + } + n += 1 + sovOnnx3(uint64(l)) + l + } + if m.DataType != 0 { + n += 1 + sovOnnx3(uint64(m.DataType)) + } + if m.Segment != nil { + l = m.Segment.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + if len(m.FloatData) > 0 { + n += 1 + sovOnnx3(uint64(len(m.FloatData)*4)) + len(m.FloatData)*4 + } + if len(m.Int32Data) > 0 { + l = 0 + for _, e := range m.Int32Data { + l += sovOnnx3(uint64(e)) + } + n += 1 + sovOnnx3(uint64(l)) + l + } + if len(m.StringData) > 0 { + for _, b := range m.StringData { + l = len(b) + n += 1 + l + sovOnnx3(uint64(l)) + } + } + if len(m.Int64Data) > 0 { + l = 0 + for _, e := range m.Int64Data { + l += sovOnnx3(uint64(e)) + } + n += 1 + sovOnnx3(uint64(l)) + l + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + l = len(m.RawData) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + if len(m.DoubleData) > 0 { + n += 1 + sovOnnx3(uint64(len(m.DoubleData)*8)) + len(m.DoubleData)*8 + } + if len(m.Uint64Data) > 0 { + l = 0 + for _, e := range m.Uint64Data { + l += sovOnnx3(uint64(e)) + } + n += 1 + sovOnnx3(uint64(l)) + l + } + l = len(m.DocString) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + if len(m.ExternalData) > 0 { + for _, e := range m.ExternalData { + l = e.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + } + if m.DataLocation != 0 { + n += 1 + sovOnnx3(uint64(m.DataLocation)) + } + return n +} + +func (m *TensorProto_Segment) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Begin != 0 { + n += 1 + sovOnnx3(uint64(m.Begin)) + } + if m.End != 0 { + n += 1 + sovOnnx3(uint64(m.End)) + } + return n +} + +func (m *SparseTensorProto) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Values != nil { + l = m.Values.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + if m.Indices != nil { + l = m.Indices.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + if len(m.Dims) > 0 { + l = 0 + for _, e := range m.Dims { + l += sovOnnx3(uint64(e)) + } + n += 1 + sovOnnx3(uint64(l)) + l + } + return n +} + +func (m *TensorShapeProto) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Dim) > 0 { + for _, e := range m.Dim { + l = e.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + } + return n +} + +func (m *TensorShapeProto_Dimension) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != nil { + n += m.Value.Size() + } + l = len(m.Denotation) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + return n +} + +func (m *TensorShapeProto_Dimension_DimValue) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovOnnx3(uint64(m.DimValue)) + return n +} +func (m *TensorShapeProto_Dimension_DimParam) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DimParam) + n += 1 + l + sovOnnx3(uint64(l)) + return n +} +func (m *TypeProto) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Value != nil { + n += m.Value.Size() + } + l = len(m.Denotation) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + return n +} + +func (m *TypeProto_TensorType) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TensorType != nil { + l = m.TensorType.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + return n +} +func (m *TypeProto_SequenceType) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SequenceType != nil { + l = m.SequenceType.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + return n +} +func (m *TypeProto_MapType) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MapType != nil { + l = m.MapType.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + return n +} +func (m *TypeProto_Tensor) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ElemType != 0 { + n += 1 + sovOnnx3(uint64(m.ElemType)) + } + if m.Shape != nil { + l = m.Shape.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + return n +} + +func (m *TypeProto_Sequence) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ElemType != nil { + l = m.ElemType.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + return n +} + +func (m *TypeProto_Map) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.KeyType != 0 { + n += 1 + sovOnnx3(uint64(m.KeyType)) + } + if m.ValueType != nil { + l = m.ValueType.Size() + n += 1 + l + sovOnnx3(uint64(l)) + } + return n +} + +func (m *OperatorSetIdProto) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Domain) + if l > 0 { + n += 1 + l + sovOnnx3(uint64(l)) + } + if m.Version != 0 { + n += 1 + sovOnnx3(uint64(m.Version)) + } + return n +} + +func sovOnnx3(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozOnnx3(x uint64) (n int) { + return sovOnnx3(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *AttributeProto) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AttributeProto: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AttributeProto: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 5 { + return fmt.Errorf("proto: wrong wireType = %d for field F", wireType) + } + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + m.F = float32(math.Float32frombits(v)) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field I", wireType) + } + m.I = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.I |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field S", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.S = append(m.S[:0], dAtA[iNdEx:postIndex]...) + if m.S == nil { + m.S = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field T", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.T == nil { + m.T = &TensorProto{} + } + if err := m.T.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field G", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.G == nil { + m.G = &GraphProto{} + } + if err := m.G.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.Floats = append(m.Floats, v2) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + packedLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.Floats) == 0 { + m.Floats = make([]float32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.Floats = append(m.Floats, v2) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Floats", wireType) + } + case 8: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Ints = append(m.Ints, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + packedLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Ints) == 0 { + m.Ints = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Ints = append(m.Ints, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Ints", wireType) + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Strings", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Strings = append(m.Strings, make([]byte, postIndex-iNdEx)) + copy(m.Strings[len(m.Strings)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tensors", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tensors = append(m.Tensors, &TensorProto{}) + if err := m.Tensors[len(m.Tensors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Graphs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Graphs = append(m.Graphs, &GraphProto{}) + if err := m.Graphs[len(m.Graphs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DocString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DocString = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 20: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= (AttributeProto_AttributeType(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 21: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RefAttrName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RefAttrName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 22: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SparseTensor", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SparseTensor == nil { + m.SparseTensor = &SparseTensorProto{} + } + if err := m.SparseTensor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 23: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SparseTensors", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SparseTensors = append(m.SparseTensors, &SparseTensorProto{}) + if err := m.SparseTensors[len(m.SparseTensors)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOnnx3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOnnx3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ValueInfoProto) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ValueInfoProto: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValueInfoProto: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Type == nil { + m.Type = &TypeProto{} + } + if err := m.Type.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DocString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DocString = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOnnx3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOnnx3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NodeProto) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NodeProto: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeProto: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Input = append(m.Input, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Output", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Output = append(m.Output, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OpType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OpType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Attribute", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Attribute = append(m.Attribute, &AttributeProto{}) + if err := m.Attribute[len(m.Attribute)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DocString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DocString = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Domain", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Domain = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOnnx3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOnnx3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ModelProto) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ModelProto: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ModelProto: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IrVersion", wireType) + } + m.IrVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.IrVersion |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProducerName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProducerName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProducerVersion", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProducerVersion = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Domain", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Domain = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ModelVersion", wireType) + } + m.ModelVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ModelVersion |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DocString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DocString = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Graph", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Graph == nil { + m.Graph = &GraphProto{} + } + if err := m.Graph.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OpsetImport", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OpsetImport = append(m.OpsetImport, &OperatorSetIdProto{}) + if err := m.OpsetImport[len(m.OpsetImport)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MetadataProps", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MetadataProps = append(m.MetadataProps, &StringStringEntryProto{}) + if err := m.MetadataProps[len(m.MetadataProps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOnnx3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOnnx3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *StringStringEntryProto) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: StringStringEntryProto: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: StringStringEntryProto: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOnnx3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOnnx3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TensorAnnotation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TensorAnnotation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TensorAnnotation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TensorName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TensorName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QuantParameterTensorNames", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.QuantParameterTensorNames = append(m.QuantParameterTensorNames, &StringStringEntryProto{}) + if err := m.QuantParameterTensorNames[len(m.QuantParameterTensorNames)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOnnx3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOnnx3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GraphProto) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GraphProto: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GraphProto: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Node", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Node = append(m.Node, &NodeProto{}) + if err := m.Node[len(m.Node)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Initializer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Initializer = append(m.Initializer, &TensorProto{}) + if err := m.Initializer[len(m.Initializer)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DocString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DocString = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Input = append(m.Input, &ValueInfoProto{}) + if err := m.Input[len(m.Input)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Output", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Output = append(m.Output, &ValueInfoProto{}) + if err := m.Output[len(m.Output)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValueInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValueInfo = append(m.ValueInfo, &ValueInfoProto{}) + if err := m.ValueInfo[len(m.ValueInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 14: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field QuantizationAnnotation", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.QuantizationAnnotation = append(m.QuantizationAnnotation, &TensorAnnotation{}) + if err := m.QuantizationAnnotation[len(m.QuantizationAnnotation)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SparseInitializer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SparseInitializer = append(m.SparseInitializer, &SparseTensorProto{}) + if err := m.SparseInitializer[len(m.SparseInitializer)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOnnx3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOnnx3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TensorProto) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TensorProto: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TensorProto: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Dims = append(m.Dims, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + packedLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Dims) == 0 { + m.Dims = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Dims = append(m.Dims, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Dims", wireType) + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DataType", wireType) + } + m.DataType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DataType |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Segment", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Segment == nil { + m.Segment = &TensorProto_Segment{} + } + if err := m.Segment.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType == 5 { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.FloatData = append(m.FloatData, v2) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + packedLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 4 + if elementCount != 0 && len(m.FloatData) == 0 { + m.FloatData = make([]float32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + if (iNdEx + 4) > l { + return io.ErrUnexpectedEOF + } + v = uint32(encoding_binary.LittleEndian.Uint32(dAtA[iNdEx:])) + iNdEx += 4 + v2 := float32(math.Float32frombits(v)) + m.FloatData = append(m.FloatData, v2) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field FloatData", wireType) + } + case 5: + if wireType == 0 { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Int32Data = append(m.Int32Data, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + packedLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Int32Data) == 0 { + m.Int32Data = make([]int32, 0, elementCount) + } + for iNdEx < postIndex { + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Int32Data = append(m.Int32Data, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Int32Data", wireType) + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StringData", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StringData = append(m.StringData, make([]byte, postIndex-iNdEx)) + copy(m.StringData[len(m.StringData)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Int64Data = append(m.Int64Data, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + packedLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Int64Data) == 0 { + m.Int64Data = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Int64Data = append(m.Int64Data, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Int64Data", wireType) + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RawData", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + byteLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RawData = append(m.RawData[:0], dAtA[iNdEx:postIndex]...) + if m.RawData == nil { + m.RawData = []byte{} + } + iNdEx = postIndex + case 10: + if wireType == 1 { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.DoubleData = append(m.DoubleData, v2) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + packedLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen / 8 + if elementCount != 0 && len(m.DoubleData) == 0 { + m.DoubleData = make([]float64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.DoubleData = append(m.DoubleData, v2) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field DoubleData", wireType) + } + case 11: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Uint64Data = append(m.Uint64Data, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + packedLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Uint64Data) == 0 { + m.Uint64Data = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Uint64Data = append(m.Uint64Data, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Uint64Data", wireType) + } + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DocString", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DocString = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExternalData", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExternalData = append(m.ExternalData, &StringStringEntryProto{}) + if err := m.ExternalData[len(m.ExternalData)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DataLocation", wireType) + } + m.DataLocation = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DataLocation |= (TensorProto_DataLocation(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipOnnx3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOnnx3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TensorProto_Segment) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Segment: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Segment: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Begin", wireType) + } + m.Begin = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Begin |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field End", wireType) + } + m.End = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.End |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipOnnx3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOnnx3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SparseTensorProto) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SparseTensorProto: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SparseTensorProto: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Values == nil { + m.Values = &TensorProto{} + } + if err := m.Values.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Indices", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Indices == nil { + m.Indices = &TensorProto{} + } + if err := m.Indices.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Dims = append(m.Dims, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + packedLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Dims) == 0 { + m.Dims = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Dims = append(m.Dims, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Dims", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipOnnx3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOnnx3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TensorShapeProto) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TensorShapeProto: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TensorShapeProto: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Dim", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Dim = append(m.Dim, &TensorShapeProto_Dimension{}) + if err := m.Dim[len(m.Dim)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOnnx3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOnnx3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TensorShapeProto_Dimension) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Dimension: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Dimension: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DimValue", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Value = &TensorShapeProto_Dimension_DimValue{v} + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DimParam", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = &TensorShapeProto_Dimension_DimParam{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denotation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denotation = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOnnx3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOnnx3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TypeProto) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TypeProto: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TypeProto: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TensorType", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &TypeProto_Tensor{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &TypeProto_TensorType{v} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SequenceType", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &TypeProto_Sequence{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &TypeProto_SequenceType{v} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MapType", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &TypeProto_Map{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Value = &TypeProto_MapType{v} + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denotation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denotation = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOnnx3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOnnx3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TypeProto_Tensor) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Tensor: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Tensor: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ElemType", wireType) + } + m.ElemType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ElemType |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Shape", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Shape == nil { + m.Shape = &TensorShapeProto{} + } + if err := m.Shape.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOnnx3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOnnx3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TypeProto_Sequence) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Sequence: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Sequence: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ElemType", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ElemType == nil { + m.ElemType = &TypeProto{} + } + if err := m.ElemType.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOnnx3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOnnx3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TypeProto_Map) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Map: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Map: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field KeyType", wireType) + } + m.KeyType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.KeyType |= (int32(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValueType", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ValueType == nil { + m.ValueType = &TypeProto{} + } + if err := m.ValueType.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOnnx3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOnnx3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OperatorSetIdProto) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: OperatorSetIdProto: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OperatorSetIdProto: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Domain", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnnx3 + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Domain = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipOnnx3(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthOnnx3 + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipOnnx3(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthOnnx3 + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowOnnx3 + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipOnnx3(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthOnnx3 = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowOnnx3 = fmt.Errorf("proto: integer overflow") +)