Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • $\begingroup$ How many elements should the result contain? Your first example will return 3 values whereas in your second example you are showing a list containing 6 values. $\endgroup$ Commented Nov 8, 2021 at 16:12
  • $\begingroup$ My first example also shows 6 count values. The number of elements that is going to be returned is the length of array x. $\endgroup$ Commented Nov 8, 2021 at 16:20
  • 1
    $\begingroup$ When running the code from your first example I get back a tensor containing only three values (assuming that arrival_times is also a tensor): tensor([4, 4, 1]). $\endgroup$ Commented Nov 8, 2021 at 16:26
  • $\begingroup$ You are right, I added the question. The dim in Torch.sum was not correct. $\endgroup$ Commented Nov 9, 2021 at 9:51