# tfr.utils.reshape_first_ndims

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/ranking/blob/v0.5.3/tensorflow_ranking/python/utils.py#L238-L256) |

Reshapes the first n dims of the input `tensor` to `new shape`.

    tfr.utils.reshape_first_ndims(
        tensor, first_ndims, new_shape
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `tensor` | The input `Tensor`. |
| `first_ndims` | A int denoting the first n dims. |
| `new_shape` | A list of int representing the new shape. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A reshaped `Tensor`. ||

<br />