Skip to content

Tensor memory management #334

Answered by decahedron1
Umenokin asked this question in Q&A
Dec 14, 2024 · 1 comments · 3 replies
Discussion options

You must be logged in to vote
  1. In reality, that might not even matter because, according to the documentation, depending on the execution provider, data can end up on the GPU, for example, so even if Tensor has a reference to an original array, would it be fair to assume that original array should not be mutated?

When using Session::run with a session allocated on a non-CPU device, the data in every input is always copied to the device before inference. Updating tensor will update the data on the GPU at the next point Session::run is called.

The only exception to this is IoBinding - a bound input must be manually synchronized in order for the data to be copied.

  1. What is the right way to update Tensor, avoiding r…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Umenokin
Comment options

@decahedron1
Comment options

@Umenokin
Comment options

Answer selected by decahedron1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants