mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
Creating test case for printing ort tensor (#10850)
* creating a test for printing ort tensor * modifying comment for error case * Using Output Grabber to assert the print output * modifying the print ort test * removing comments * removing sys import
This commit is contained in:
parent
ce10d7d231
commit
03181caeae
1 changed files with 6 additions and 7 deletions
|
|
@ -120,13 +120,12 @@ class OrtEPTests(unittest.TestCase):
|
|||
ort_device = torch_ort.device(1)
|
||||
assert 'My EP provider created, with device id: 0, some_option: val' in out.capturedtext
|
||||
|
||||
#disable the print test for now as we need to merge a PR to pytorch first.
|
||||
#def test_print(self):
|
||||
# x = torch.ones(1, 2)
|
||||
# ort_x = x.to('ort')
|
||||
# with OutputGrabber() as out:
|
||||
# print(ort_x)
|
||||
# assert "tensor([[1., 1.]], device='ort:0')" in out.capturedtext
|
||||
def test_print(self):
|
||||
x = torch.ones(1, 2)
|
||||
ort_x = x.to('ort')
|
||||
with OutputGrabber() as out:
|
||||
print(ort_x)
|
||||
assert "tensor([[1., 1.]], device='ort:0')" in out.capturedtext
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Loading…
Reference in a new issue