Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancements: new IR version and new version for tensor and Gorgonia #176

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4a4128d
feat: flag for console output
owulveryck Nov 19, 2019
357a04d
Merge branch 'master' of github.com:owulveryck/onnx-go
owulveryck Dec 30, 2019
0723d84
Merge branch 'master' of github.com:owulveryck/onnx-go
owulveryck Dec 30, 2019
0a3064e
Merge branch 'master' of github.com:owulveryck/onnx-go
owulveryck Dec 30, 2019
df1fefe
fix: extension of the input and output format is pb
owulveryck Jan 21, 2020
e3880e5
feat: new generation from onnx 20200121
owulveryck Jan 21, 2020
7e77691
feat: bump onnx version to 6
owulveryck Jan 21, 2020
d3bd763
feat: bump version of gorgonia and tensor
owulveryck Jan 21, 2020
8eafcd1
chore: README
owulveryck Jan 21, 2020
7b85732
feat: add a failfast flag to stop the test with an accurate message
owulveryck Jan 21, 2020
1531cd3
feat: negative axis
owulveryck Jan 21, 2020
f695610
chore: gemm does not support default bias
owulveryck Jan 21, 2020
c3801ca
feat: add dump of the model for debugging purpose
owulveryck Feb 16, 2020
462554b
chore: new generation with dump
owulveryck Feb 16, 2020
6d07d05
chore: clean old versions
owulveryck Feb 16, 2020
fcf050a
chore: gorgonia v0.9.8
owulveryck Feb 16, 2020
8371447
chore: bump version of onnx
owulveryck Feb 16, 2020
d75e5d8
chore: version generated from the last IR
owulveryck Feb 16, 2020
5900a54
feat: retun an error on negative dims
owulveryck Feb 16, 2020
fd10383
feat: retun an error on negative dims
owulveryck Feb 16, 2020
46279ff
fix: exit with "NotImplemented" if ratio is used
owulveryck Feb 16, 2020
164d821
chore: a pass of mathfmt
owulveryck Feb 16, 2020
0e3fb28
chore: skip test while waiting for a version handlinng to skip them m…
owulveryck Feb 20, 2020
36c22fd
chore: temp hack
owulveryck Feb 20, 2020
fe28167
feat: bump version of gorgonia etc.
owulveryck Jun 16, 2020
fcadb1a
go 1.14
owulveryck Jun 16, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: go
sudo: false
go:
- 1.13.x
- 1.14.x

before_install:
- make install
Expand Down
2 changes: 0 additions & 2 deletions backend/testbackend/onnx/doc.go

This file was deleted.

7 changes: 5 additions & 2 deletions backend/testbackend/onnx/gen_cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions backend/testbackend/onnx/gen_cmd/test_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -101,6 +102,9 @@ func init() {
testbackend.Register("{{ .OpType }}","{{ .TestName }}",New{{ .TestName }})
}

/*
{{ .Dump }}
*/

// New{{ .TestName }} {{ .Description }}
func New{{ .TestName }}() *testbackend.TestCase{
Expand Down
94 changes: 94 additions & 0 deletions backend/testbackend/onnx/onnx_test_abs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
94 changes: 94 additions & 0 deletions backend/testbackend/onnx/onnx_test_acos.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
78 changes: 78 additions & 0 deletions backend/testbackend/onnx/onnx_test_acos_example.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
Loading