A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pytorch/pytorch/issues/61901 below:

Reducing over empty dimensions for reductions without identity · Issue #61901 · pytorch/pytorch · GitHub

This issue is for discussing what should be the result fo reducing nothing. Ideally, this behavior should be consistent across our reduction operators, however, this is what the current reductions return.

* max, min → always raise an error. NumPy always errors
* sum → always return 0 (identity value)
* prod → always return 1 (identity value)
* amax, amin → garbage value for dim=None, otherwise error. NumPy always errors
* mean → returns nan. NumPy raises warning and returns nan
* median → without dim returns nan for floating point inputs and garbage for integral, with dim errors. NumPy raises a warning and returns nan, however NumPy also promotes to floating point which we should not do. So we should error for integral input at least.
* mode → raises an error
* std(_mean), var(_mean) → always returns nan. NumPy raises warning and returns nan.
* logsumexp → returns -inf
* quantile → raises an error, nanquantile where all inputs are nan returns nan, this should be consistent with quantile over empty dimension. NumPy raises an IndexError for quantile but returns nan for nanquantile.
* kthvalue → raises an error
* topk → only allowed for k=0 in which case an empty tensor is returned
* argmax, argmin → always raise an error
* all → always returns True (identity)
* any → always returns False (identity)
* count_nonzero → always returns 0 (identity)
* linalg.vector_norm → if selected ord has identity, returns it otherwise raises error

Some options for making this consistent are:

cc @mruberry @rgommers @heitorschueroff


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4