haojin2 commented on a change in pull request #18049: [numpy] add numpy op
fill_diagonal
URL: https://github.com/apache/incubator-mxnet/pull/18049#discussion_r409958205
##########
File path: python/mxnet/symbol/numpy/_symbol.py
##########
@@ -6582,6 +6582,102 @@ def resize(a, new_shape):
return _npi.resize_fallback(a, new_shape=new_shape)
+@set_module('mxnet.symbol.numpy')
+def fill_diagonal(a, val, wrap=False):
+ """
+ Fill the main diagonal of the given array of any dimensionality.
+ For an array `a` with ``a.ndim >= 2``, the diagonal is the list of
+ locations with indices ``a[i, ..., i]`` all identical. This function
+ modifies the input array in-place, it does not return a value.
+ Parameters
+ ----------
+ a : array, at least 2-D.
+ Array whose diagonal is to be filled, it gets modified in-place.
+ val : scalar
+ Value to be written on the diagonal, its type must be compatible with
+ that of the array a.
+ wrap : bool
+ For tall matrices in NumPy version up to 1.6.2, the
+ diagonal "wrapped" after N columns. You can have this behavior
+ with this option. This affects only tall matrices.
+ See also
+ --------
+ diag_indices, diag_indices_from
+ Notes
+ -----
+ .. versionadded:: 1.4.0
+ This functionality can be obtained via `diag_indices`, but internally
+ this version uses a much faster implementation that never constructs the
+ indices and uses simple slicing.
+ Examples
Review comment:
actually no need for `examples` for symbol
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services