Skip to content

Commit

Permalink
Update custom_ops.md (#795)
Browse files Browse the repository at this point in the history
add domain for SentencePiece Op
  • Loading branch information
zhipenghan authored Aug 21, 2024
1 parent 711a2cf commit 85ffb94
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docs/custom_ops.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,8 @@ node = onnx.helper.make_node(
outputs=['indices', 'output'],
mapping_file_name='vocabulary.txt',
unmapping_value="unknown_word",
model=model
model=model,
domain='ai.onnx.contrib'
)

inputs = np.array(["Hello world", "Hello world louder"], dtype=object),
Expand All @@ -459,8 +460,8 @@ add_bos = np.array([0], dtype=np.bool_),
add_eos = np.array([0], dtype=np.bool_),
reverse = np.array([0], dtype=np.bool_)

tokens = array([17486, 1017, 17486, 1017, 155, 21869], dtype=int32)
indices = array([0, 2, 6], dtype=int64)
tokens = np.array([17486, 1017, 17486, 1017, 155, 21869], dtype=np.int32)
indices = np.array([0, 2, 6], dtype=np.int64)

expect(node, inputs=[inputs, nbest_size, alpha, add_bos, add_eos, reverse],
outputs=[tokens, indices], name='sp')
Expand Down Expand Up @@ -1597,4 +1598,4 @@ def run_add_f():
}
out = sess.run(None, ort_inputs)[0]
```
</details>
</details>

0 comments on commit 85ffb94

Please sign in to comment.