Skip to main content

Mojo struct

ValueCount

@register_passable(trivial) 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, Movable, UnknownDestructibility

Aliases

__copyinit__is_trivial

alias __copyinit__is_trivial = True

__del__is_trivial

alias __del__is_trivial = True

__moveinit__is_trivial

alias __moveinit__is_trivial = True

Methods

__init__

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

__init__() -> Self

__add__

__add__(self, other: Self) -> Self

__iadd__

__iadd__(mut self, other: Self)

Was this page helpful?