# How to predict only one test sample in pytorch model?

**URL:** <https://discuss.pytorch.org/t/how-to-predict-only-one-test-sample-in-pytorch-model/81407>\
**Category:** Uncategorized\
**Created:** [May 15, 2020, 4:27pm UTC](https://discuss.pytorch.org/t/how-to-predict-only-one-test-sample-in-pytorch-model/81407 "2020-05-15T16:27:44Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Brando\_Miranda](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/brando_miranda/32/14355_2.png) [@Brando\_Miranda](https://discuss.pytorch.org/u/Brando_Miranda)\
**Post date:** [August 4, 2020, 9:02pm UTC](https://discuss.pytorch.org/t/how-to-predict-only-one-test-sample-in-pytorch-model/81407/7 "2020-08-04T21:02:26Z")

</div>

can you explain why:

```auto
torch.max(output.data, 1)

```

works?

I was reading the docs ([https://pytorch.org/docs/stable/generated/torch.max.html](https://pytorch.org/docs/stable/generated/torch.max.html)) and it’s still not entirely clear to me. This is the sentence that doesn’t make sense to me:

```auto
Returns a namedtuple (values, indices) where values is the maximum value of each row of the input tensor in the given dimension dim.

```

I don’t understand what the max value of a row mean given a specific slice of a tensor. Rows only exist in 2D tensors (matrices), at least to me. Can you clarify?

---

_[View the full topic](https://discuss.pytorch.org/t/how-to-predict-only-one-test-sample-in-pytorch-model/81407)._
