One: [onert] What is UserTensor, ManagedTensor, ConstTensor, StaticTensor, ExternalTensor ...?

Created on 17 Jul 2020  Â·  6Comments  Â·  Source: Samsung/ONE

Related: https://github.com/Samsung/ONE/pull/3228#issuecomment-659216196

I am seeing terms ExternalTensor, UserTensor, managed tensor from recent PRs #3228, #3229, #3102, ....

I am not familiar with them. Maybe I am not the first people who don't know them — https://github.com/Samsung/ONE/pull/3102#issuecomment-658665259, https://github.com/Samsung/ONE/pull/3102#discussion_r455510607
Thus, It would be good if someone kindly explains them in one place so that other members could find out the information easily.

I gathered information from several comment here and there.

Term | The opposite Term | What is it?
-- | -- | --
? | ExternalTensor | https://github.com/Samsung/ONE/pull/3102#discussion_r455573649, https://github.com/Samsung/ONE/pull/3228#issuecomment-659224119 — Still not clear
StaticTensor | _(perhaps)_ DynamicTensor | Whether the ~allocation is~ shape can be determined at prepare time or execution time. Note 1: allocation can be made right after shape is calculated. However, we can delay allocation to some moment. (we don't have such code yet but refer to https://github.com/Samsung/ONE/issues/2525#issuecomment-658501660 for possible implementation. Therefore assert(buf) is recommended before write data into allocated memory.
Note 2: A tensor must be one of static tensor or dynamic tensor and use ITensor::is_dynamic().
ConstTensor | NonConstTensor | Is it const or not
ManagedTensor | ???Tensor | Is it managed by TensorManager
UserTensor | ? | https://github.com/Samsung/ONE/pull/3102#issuecomment-658677553
PortableTensor | ? | https://github.com/Samsung/ONE/pull/2492

Could you please anyone check and update/fix?

@wateret, @YongseopKim

question

Most helpful comment

@wateret explained about ManagedTensor and ExternalTensor to me. Let me summarize.

  • A Backend has a TensorRegistry.
  • A TensorRegistry is a place for registring and holding tensors.
  • A TensorRegistry has tensors as two types(You can imagine two divided pools)

    • Type ManagedTensors: these tensors will be managed by the owned backend directly.

    • Type ExternalTensors: these tensors will be managed by the other backend. It is meaning that C backend allocates a tensor so that manage it, but D backend will use the tensor as an external tensor.

  • Therefore, a tensor should be in a TensorRegistry as a managed tensor but the tensor could be in another TensorRegistries as an external tensor.

All 6 comments

@wateret explained about ManagedTensor and ExternalTensor to me. Let me summarize.

  • A Backend has a TensorRegistry.
  • A TensorRegistry is a place for registring and holding tensors.
  • A TensorRegistry has tensors as two types(You can imagine two divided pools)

    • Type ManagedTensors: these tensors will be managed by the owned backend directly.

    • Type ExternalTensors: these tensors will be managed by the other backend. It is meaning that C backend allocates a tensor so that manage it, but D backend will use the tensor as an external tensor.

  • Therefore, a tensor should be in a TensorRegistry as a managed tensor but the tensor could be in another TensorRegistries as an external tensor.

RENAMED

ManagedTensors → NativeTensors
ExternalTensors → MigrantTensors (To distinguish it with cpu backend's ExternalTensor)

@YongseopKim Could you please write doxygen comments for cpu backend's ExternalTensor as well?

@wateret sure. I'll upload soon.

I think the term is almost described here and renamed (e.g. #4271)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

YongseopKim picture YongseopKim  Â·  3Comments

kishcs picture kishcs  Â·  3Comments

periannath picture periannath  Â·  3Comments

underflow101 picture underflow101  Â·  4Comments

ragmani picture ragmani  Â·  4Comments