MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / calculate_subsampled_shape

Function calculate_subsampled_shape

arm_compute/core/Validate.h:406–428  ·  view source on GitHub ↗

Calculate subsampled shape for a given format and channel * * @param[in] shape Shape of the tensor to calculate the extracted channel. * @param[in] format Format of the tensor. * @param[in] channel Channel to create tensor shape to be extracted. * * @return The subsampled tensor shape. */

Source from the content-addressed store, hash-verified

404 * @return The subsampled tensor shape.
405 */
406inline TensorShape
407calculate_subsampled_shape(const TensorShape &shape, Format format, Channel channel = Channel::UNKNOWN)
408{
409 TensorShape output{shape};
410
411 // Subsample shape only for U or V channel
412 if (Channel::U == channel || Channel::V == channel || Channel::UNKNOWN == channel)
413 {
414 // Subsample width for the tensor shape when channel is U or V
415 if (has_format_horizontal_subsampling(format))
416 {
417 output.set(0, output.x() / 2U);
418 }
419
420 // Subsample height for the tensor shape when channel is U or V
421 if (has_format_vertical_subsampling(format))
422 {
423 output.set(1, output.y() / 2U);
424 }
425 }
426
427 return output;
428}
429
430/** Return an error if the passed tensor objects are not sub-sampled.
431 *

Callers 1

Calls 5

setMethod · 0.45
xMethod · 0.45
yMethod · 0.45

Tested by

no test coverage detected