用法:
mxnet.ndarray.op.stop_gradient(data=None, out=None, name=None, **kwargs)
out:- 此函數的輸出。
NDArray 或 NDArray 列表
參數:
返回:
返回類型:
停止梯度計算。
阻止輸入的累積梯度反向流過此運算符。換句話說,這個算子阻止了計算梯度時考慮其輸入的貢獻。
例子:
v1 = [1, 2] v2 = [0, 1] a = Variable('a') b = Variable('b') b_stop_grad = stop_gradient(3 * b) loss = MakeLoss(b_stop_grad + a) executor = loss.simple_bind(ctx=cpu(), a=(1,2), b=(1,2)) executor.forward(is_train=True, a=v1, b=v2) executor.outputs [ 1. 5.] executor.backward() executor.grad_arrays [ 0. 0.] [ 1. 1.]
相關用法
- Python mxnet.ndarray.op.stack用法及代碼示例
- Python mxnet.ndarray.op.sample_negative_binomial用法及代碼示例
- Python mxnet.ndarray.op.slice_like用法及代碼示例
- Python mxnet.ndarray.op.softmax_cross_entropy用法及代碼示例
- Python mxnet.ndarray.op.sample_uniform用法及代碼示例
- Python mxnet.ndarray.op.sort用法及代碼示例
- Python mxnet.ndarray.op.sample_gamma用法及代碼示例
- Python mxnet.ndarray.op.scatter_nd用法及代碼示例
- Python mxnet.ndarray.op.sign用法及代碼示例
- Python mxnet.ndarray.op.smooth_l1用法及代碼示例
- Python mxnet.ndarray.op.sample_exponential用法及代碼示例
- Python mxnet.ndarray.op.sgd_update用法及代碼示例
- Python mxnet.ndarray.op.sample_multinomial用法及代碼示例
- Python mxnet.ndarray.op.squeeze用法及代碼示例
- Python mxnet.ndarray.op.sample_normal用法及代碼示例
- Python mxnet.ndarray.op.sum用法及代碼示例
- Python mxnet.ndarray.op.space_to_depth用法及代碼示例
- Python mxnet.ndarray.op.slice_axis用法及代碼示例
- Python mxnet.ndarray.op.softmin用法及代碼示例
- Python mxnet.ndarray.op.sample_poisson用法及代碼示例
注:本文由純淨天空篩選整理自apache.org大神的英文原創作品 mxnet.ndarray.op.stop_gradient。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。