Skip to content

Broadcasting operations #38

Answered by davoclavo
darrenjw asked this question in Q&A
Jul 8, 2023 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

Hi @darrenjw !

At first glance, it seems that torch.mean is working as expected, albeit a bug I just stumbled upon but not sure if its what you are facing (details below).

However, I would love to hear if you have a distinct use case or piece of code that I could use to replicate some problem you may be facing.

Thanks and have a great weekend!

Expected behaviour

Python

In [10]: a = torch.randn(4,4)

In [11]: a
Out[11]:
tensor([[ 1.9802,  0.9503, -0.1127, -0.1499],
        [ 0.6870,  0.0417, -0.6196,  0.5293],
        [ 0.1721,  1.2434,  1.2598,  0.4497],
        [-1.8520,  1.0415, -0.1979, -0.3671]])

In [12]: torch.mean(a, 0)
Out[12]: tensor([0.2468, 0.8192, 0.0824, 0.1155])

Scala

@ val a =

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@darrenjw
Comment options

@davoclavo
Comment options

Answer selected by darrenjw
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants