# Method diff

#### static member diff: Tensor<'T> -> Tensor<'T>

Calculates the difference between adjoining elements of the vector.

##### Declaration

`static member diff: a:Tensor<'T> -> Tensor<'T>`

##### Parameters

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

Tensor<'T> | a | The vector containing the source values. |

##### Returns

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

Tensor<'T> | The differences vector. It has one element less than the input tensor. |

##### Remarks

The value of output element `i`

is given by `d_i = a_(i+1) - a_i`

.

The resulting vector has one element less in the last dimension than the original vector.

If the input tensor has more than one dimension, this operation is applied batch-wise on the last dimension.

##### Examples

```
let a = HostTensor.zeros [5L]
let b = Tensor.diff a // b.Shape = [4L]
```