Skip to content

Commit

Permalink
fix(!): rename PySession -> Session
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelspark committed Mar 5, 2023
1 parent 8e24aa0 commit dd88065
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ pip install wonnx
And then, to use:

```python
from wonnx import PySession
session = PySession.from_path(
from wonnx import Session
session = Session.from_path(
"../data/models/single_relu.onnx"
)
inputs = {"x": [-1.0, 2.0]}
Expand Down
2 changes: 1 addition & 1 deletion wonnx-py/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use pyo3::types::PyDict;
use std::collections::HashMap;

use ::wonnx::Session;
#[pyclass]
#[pyclass(name = "Session")]
#[repr(transparent)]
pub struct PySession {
pub session: Session,
Expand Down
2 changes: 1 addition & 1 deletion wonnx-py/tests/test_onnx_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self, inputs, outputs, outputs_shape, model):
self.inputs = inputs
self.outputs = outputs
self.outputs_shape = outputs_shape
self.session = wonnx.PySession.from_bytes(onnx._serialize(model))
self.session = wonnx.Session.from_bytes(onnx._serialize(model))
self.rtol = 1
pass

Expand Down
8 changes: 4 additions & 4 deletions wonnx-py/tests/test_wonnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ def test_parse_model():
model_def = helper.make_model(graph_def, producer_name="onnx-example")
model = onnx.shape_inference.infer_shapes(model_def)

session = wonnx.PySession.from_bytes(onnx._serialize(model))
session = wonnx.Session.from_bytes(onnx._serialize(model))
inputs = {"x": [-1.0, 2.0]}
assert session.run(inputs) == {"y": [0.0, 2.0]}, "Single Relu does not work"


def test_from_path():

# Create the model (ModelProto)
session = wonnx.PySession.from_path(
session = wonnx.Session.from_path(
"../examples/data/models/single_relu.onnx"
)
inputs = {"x": [-1.0, 2.0]}
Expand All @@ -51,7 +51,7 @@ def test_mnist():
input = np.reshape(gray, (1, 1, 28, 28))
# Create the model (ModelProto)

session = wonnx.PySession.from_path(
session = wonnx.Session.from_path(
"../examples/data/models/opt-mnist.onnx"
)
inputs = {"Input3": input.flatten().tolist()}
Expand Down Expand Up @@ -79,7 +79,7 @@ def test_squeezenet():
input_tensor = transform(image)
# Create the model (ModelProto)

session = wonnx.PySession.from_path(
session = wonnx.Session.from_path(
"../examples/data/models/opt-squeeze.onnx"
)
inputs = {"data": input_tensor.flatten().tolist()}
Expand Down

0 comments on commit dd88065

Please sign in to comment.