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

Function calcIndex

samples/sampleIOFormats/sampleIOFormats.cpp:519–534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

517}
518
519int32_t calcIndex(SampleBuffer& buffer, int32_t c, int32_t h, int32_t w)
520{
521 int32_t index;
522
523 if (!buffer.desc.channelPivot)
524 {
525 index = c / buffer.desc.dims[4] * buffer.desc.dims[2] * buffer.desc.dims[3] * buffer.desc.dims[4]
526 + h * buffer.desc.dims[3] * buffer.desc.dims[4] + w * buffer.desc.dims[4] + c % buffer.desc.dims[4];
527 }
528 else
529 {
530 index = h * buffer.desc.dims[3] * buffer.desc.dims[2] + w * buffer.desc.dims[3] + c;
531 }
532
533 return index;
534}
535
536//!
537//! \brief Reformats the buffer. Src and dst buffers should be of same datatype and dims.

Callers 1

reformatFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected