mxnet.npx.log_softmax¶
-
log_softmax
(data, axis=-1, length=None, temperature=None, use_length=False, dtype=None)¶ Computes the log softmax of the input. This is equivalent to computing softmax followed by log.
- Parameters
data (NDArray) – The input array.
axis (int, optional, default='-1') – The axis along which to compute softmax.
length (NDArray) – The length array.
temperature (double or None, optional, default=None) – Temperature parameter in softmax
dtype ({None, 'float16', 'float32', 'float64'},optional, default='None') – DType of the output in case this can’t be inferred. Defaults to the same as input’s dtype if not defined (dtype=None).
use_length (boolean or None, optional, default=0) – Whether to use the length input as a mask over the data input.
- Returns
out – The output of this function.
- Return type
NDArray or list of NDArrays
Examples
>>> data = np.array([1, 2, .1]) >>> npx.log_softmax(data) array([-1.4170278, -0.4170278, -2.3170278]) >>> data = np.array([[1, 2, .1],[.1, 2, 1]]) >>> npx.log_softmax(data, axis=0) array([[-0.34115386, -0.6931472 , -1.2411538 ], [-1.2411538 , -0.6931472 , -0.34115386]])
Did this page help you?
Yes
No
Thanks for your feedback!