Skip to content
ml-recall

#distance

1 question from PyTorch

Timed test

1 question · 1 min · score and explanations at the end

Take a test
Q 1 / 1Score 0 / 0

Question 1: Short answer

easyAI-checkedPyTorch

This snippet was meant to compute the Manhattan distance between two vectors:

x1 = torch.tensor([6., 1., 4., 5.])
x2 = torch.tensor([2., 8., 3., -1.])
dist = torch.sqrt(torch.pow(x1 - x2, 2).sum())
print(dist)

What does it print? Round to 2 decimals.

a number, 2 decimals