Skip to main content

Mojo struct

ValueCount

struct ValueCount[T: DType]

A struct that holds a value and a count, used for block reductions.

This is useful for computing both the sum of values and the count of elements that satisfy a condition in a single reduction pass.

Parameters​

  • ​T (DType): The DType of the value field.

Fields​

  • ​value (Scalar[T]):
  • ​count (Int32):

Implemented traits​

AnyType, Copyable, Defaultable, ImplicitlyCopyable, ImplicitlyDestructible, Movable, RegisterPassable, TrivialRegisterPassable

Methods​

__init__​

__init__(value: Scalar[T], count: Int32) -> Self

__init__() -> Self

__add__​

__add__(self, other: Self) -> Self

__iadd__​

__iadd__(mut self, other: Self)