---
title: "bitwisePopulationCount(_:name:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Instance Method
path: "metalperformanceshadersgraph/mpsgraph/bitwisepopulationcount(_:name:)"
---

# bitwisePopulationCount(_:name:)

Returns the population count of the input tensor elements.

## Declaration

```swift
func bitwisePopulationCount(_ tensor: MPSGraphTensor, name: String?) -> MPSGraphTensor
```

## Parameters

- `tensor`: The input tensor, which must be of integer type.
- `name`: An optional string which serves as an identifier for the operation.

## Return Value

Return Value A valid MPSGraphTensor object containing the elementwise result of the applied operation.

## Discussion

Discussion This operation only accepts integer tensors, and returns the number of bits set in the input element.
