本文簡要介紹python語言中 torch.nn.Threshold
的用法。
用法:
class torch.nn.Threshold(threshold, value, inplace=False)
threshold-閾值的值
value-要替換的值
inplace-可以選擇就地執行操作。默認值:
False
閾值輸入張量的每個元素。
閾值定義為:
- 形狀:
輸入: ,其中 表示任意數量的維度。
輸出: ,與輸入的形狀相同。
例子:
>>> m = nn.Threshold(0.1, 20) >>> input = torch.randn(2) >>> output = m(input)
參數:
相關用法
- Python PyTorch Tensor.unflatten用法及代碼示例
- Python PyTorch Tensor.register_hook用法及代碼示例
- Python PyTorch TransformerEncoder用法及代碼示例
- Python PyTorch TarArchiveLoader用法及代碼示例
- Python PyTorch Tensor.storage_offset用法及代碼示例
- Python PyTorch Tensor.to用法及代碼示例
- Python PyTorch Tensor.sparse_mask用法及代碼示例
- Python PyTorch Timer用法及代碼示例
- Python PyTorch TimeMasking用法及代碼示例
- Python PyTorch TripletMarginLoss用法及代碼示例
- Python PyTorch Tacotron2TTSBundle.get_text_processor用法及代碼示例
- Python PyTorch Tensor.is_leaf用法及代碼示例
- Python PyTorch Tensor.imag用法及代碼示例
- Python PyTorch Tensor.unfold用法及代碼示例
- Python PyTorch TenCrop用法及代碼示例
- Python PyTorch Tensor.real用法及代碼示例
- Python PyTorch TwRwSparseFeaturesDist用法及代碼示例
- Python PyTorch Tensor.refine_names用法及代碼示例
- Python PyTorch Tanh用法及代碼示例
- Python PyTorch Tensor.rename用法及代碼示例
- Python PyTorch TransformedDistribution用法及代碼示例
- Python PyTorch Tensor.view用法及代碼示例
- Python PyTorch Tensor.new_empty用法及代碼示例
- Python PyTorch Tensor.index_copy_用法及代碼示例
- Python PyTorch TripletMarginWithDistanceLoss用法及代碼示例
注:本文由純淨天空篩選整理自pytorch.org大神的英文原創作品 torch.nn.Threshold。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。