MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / reallocateOutput

Method reallocateOutput

samples/common/sampleDevice.h:486–498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

484 }
485
486 void* reallocateOutput(
487 char const* tensorName, void* currentMemory, uint64_t size, uint64_t alignment) noexcept override
488 {
489 // Some memory allocators return nullptr when allocating zero bytes, but TensorRT requires a non-null ptr
490 // even for empty tensors, so allocate a dummy byte.
491 size = std::max(size, static_cast<uint64_t>(1));
492 if (size > mSize)
493 {
494 mBuffer->allocate(roundUp(size, alignment));
495 mSize = size;
496 }
497 return mBuffer->getDeviceBuffer();
498 }
499
500 void notifyShape(char const* tensorName, nvinfer1::Dims const& dims) noexcept override {}
501

Callers

nothing calls this directly

Calls 4

maxFunction · 0.85
roundUpFunction · 0.70
allocateMethod · 0.45
getDeviceBufferMethod · 0.45

Tested by

no test coverage detected