---
title: "sum"
sidebar_label: "sum"
description: "Kotlin binding reference: sum."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.runtime](../index.md)/[Tensor](index.md)/[sum](sum.md)

# sum

[common]\
fun [sum](sum.md)(): [Tensor](index.md)

The whole-tensor sum, a 0-D tensor.

[common]\
fun [sum](sum.md)(dims: [LongArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long-array/index.html), keepdim: [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) = false): [Tensor](index.md)

The sum along [dims](sum.md); [keepdim](sum.md) keeps the reduced dims as size 1.