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

Is Conv1D supported? #210

Open
carbocation opened this issue Aug 27, 2023 · 0 comments
Open

Is Conv1D supported? #210

carbocation opened this issue Aug 27, 2023 · 0 comments

Comments

@carbocation
Copy link

I have an onnx model that expects input in the shape (B, C, S), where S is signal. E.g., (1, 1, 350). When I try to initialize this based on the demo (code shown below), I run into the error shown beneath the code. Is Conv1D not supported, or should I modify how I am setting up the input (which is currently tensor.New(tensor.WithShape(1, 1, signalLength), tensor.Of(tensor.Float32)))?

package main

import (
	"fmt"
	"log"
	"os"

	"github.com/owulveryck/onnx-go"
	"github.com/owulveryck/onnx-go/backend/x/gorgonnx"
	"gorgonia.org/tensor"
)

var signalLength = 350

func main() {
	// Create a backend receiver
	backend := gorgonnx.NewGraph()
	// Create a model and set the execution backend
	model := onnx.NewModel(backend)

	// read the onnx model
	b, _ := os.ReadFile("../model.pt.onnx")
	// Decode it into the model
	err := model.UnmarshalBinary(b)
	if err != nil {
		log.Fatal(err)
	}

	// Set the first input, the number depends of the model
	input := tensor.New(tensor.WithShape(1, 1, signalLength), tensor.Of(tensor.Float32))
	model.SetInput(0, input)
	err = backend.Run()
	if err != nil {
		log.Fatal(err)
	}
	// Check error
	output, _ := model.GetOutputTensors()
	// write the first output to stdout
	fmt.Println(output[0])
}

Error:

go run *.go
2023/08/27 14:22:30 conv: kernel shape is supposed to have a dim of 2
exit status 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant