# Method foldAxis

#### val foldAxis: 'T -> 'TA -> 'T -> Tensor<'T> -> int -> Tensor<'TA> -> Tensor<'T>

Applies to specified function to all elements of the tensor, threading an accumulator through the computation.

##### Declaration

`val foldAxis: fn:'T -> 'TA -> 'T -> initial:Tensor<'T> -> axis:int -> a:Tensor<'TA> -> Tensor<'T>`

##### Parameters

Type | Name | Description |
---|---|---|

'T -> 'TA -> 'T | fn | A function that takes a state value and a value from the input tensor and returns a new state value. |

Tensor<'T> | initial | The initial state value. |

int | axis | The axis to fold over. |

Tensor<'TA> | a | The source tensor. |

##### Returns

Type | Description |
---|---|

Tensor<'T> | The output tensor containg the final states. |

##### Type Parameters

Name | Description |
---|---|

'T | The type of the data. |

'TA |

##### See Also

HostTensor.Parallel.foldAxis``2