# Method convert

#### static member convert: Tensor<'C> -> Tensor<'T>

Convert the elements of a tensor to the specifed type.

##### Declaration

`static member convert: a:Tensor<'C> -> Tensor<'T>`

##### Parameters

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

Tensor<'C> | a | The tensor to convert. |

##### Returns

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

Tensor<'T> | A tensor of the new data type. |

##### Type Parameters

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

'C | The data type to convert from. |

##### Remarks

The elements of the original tensor are copied into the new tensor and their type is converted during the copy.

For tensors that contain data of non-primitive types and are stored on the host,
the `op_Explicit`

or `op_Implicit`

methods of the source or destination type are used to perform
the conversion.

##### Examples

```
let a = HostTensor.ofList [1; 2; 3]
let b = Tensor<float>.convert a // b = [1.0; 2.0; 3.0]
```