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

python - StringIO & BytesIO #198

Open
1 task
junxnone opened this issue Apr 24, 2020 · 0 comments
Open
1 task

python - StringIO & BytesIO #198

junxnone opened this issue Apr 24, 2020 · 0 comments

Comments

@junxnone
Copy link
Owner

junxnone commented Apr 24, 2020

Reference

Brief

  • StringIO - 在内存中读写 str
  • BytesIO - 在内存中读写 Byte

  • getvalue() 方法用于获得写入后的值

Example

   with torch.no_grad():
        with io.BytesIO() as f:
            torch.onnx.export(
                model,
                inputs,
                f,
                operator_export_type=OperatorExportTypes.ONNX_ATEN_FALLBACK,
                # verbose=True,  # NOTE: uncomment this for debugging
                # export_params=True,
            )
            onnx_model = onnx.load_from_string(f.getvalue())
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