MCPcopy Create free account
hub / github.com/apache/tvm-ffi / SwitchContainer

Method SwitchContainer

include/tvm/ffi/container/array.h:712–721  ·  view source on GitHub ↗

! * \brief Move or copy the ArrayObj to new address with the given capacity * \param capacity The capacity requirement of the new address */

Source from the content-addressed store, hash-verified

710 * \param capacity The capacity requirement of the new address
711 */
712 ArrayObj* SwitchContainer(int64_t capacity) {
713 if (data_ == nullptr) {
714 data_ = ArrayObj::Empty(capacity);
715 } else if (data_.unique()) {
716 data_ = ArrayObj::MoveFrom(capacity, GetArrayObj());
717 } else {
718 data_ = ArrayObj::CopyFrom(capacity, GetArrayObj());
719 }
720 return static_cast<ArrayObj*>(data_.get());
721 }
722
723 /*! \brief Helper method for mutate/map
724 *

Callers

nothing calls this directly

Calls 3

EmptyFunction · 0.50
uniqueMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected