Code:
Microsoft Windows [V 10.0.18363.1256]
(c) 2019 Microsoft Corporation。
C:\Users\chenxuqi>conda activate ssd4pytorch1_2_0
(ssd4pytorch1_2_0) C:\Users\chenxuqi>python
Python 3.7.7 (default, May 6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.manual_seed(seed=20200910)
<torch._C.Generator object at 0x000001CD8F73D330>
>>>
>>> input = torch.randn(3, 5)
>>> input
tensor([[ 0.2824, -0.3715, 0.9088, -1.7601, -0.1806],
[ 2.0937, 1.0406, -1.7651, 1.1216, 0.8440],
[ 0.1783, 0.6859, -1.5942, -0.2006, -0.4050]])
>>>
>>>
>>> output1 = torch.nn.ReLU()(input)
>>> output1
tensor([[0.2824, 0.0000, 0.9088, 0.0000, 0.0000],
[2.0937, 1.0406, 0.0000, 1.1216, 0.8440],
[0.1783, 0.6859, 0.0000, 0.0000, 0.0000]])
>>>
>>> input
tensor([[ 0.2824, -0.3715, 0.9088, -1.7601, -0.1806],
[ 2.0937, 1.0406, -1.7651, 1.1216, 0.8440],
[ 0.1783, 0.6859, -1.5942, -0.2006, -0.4050]])
>>> output2 = torch.nn.functional.relu(input)
>>> output2
tensor([[0.2824, 0.0000, 0.9088, 0.0000, 0.0000],
[2.0937, 1.0406, 0.0000, 1.1216, 0.8440],
[0.1783, 0.6859, 0.0000, 0.0000, 0.0000]])
>>>
>>>
>>>
Similar Posts:
- PyTorch UserWarning: volatile was removed and now has no effect. Use `with torch.no_grad():` inst
- [Solved] pytorchImportError: numpy.core.multiarray failed to import
- Solutions to errors encountered by Python
- Pytorch: How to Use pack_padded_sequence & pad_packed_sequence
- Pytorch Install Error: OSError: [WinError 126] Could not Find the Module, Error loading “xx\lib\site-packages\torch\lib\asmjit.dl
- Bug—-QXcbConnection: Could not connect to display Aborted (core dumped)
- jupyter notebook error: No module named ‘tensorflow’
- [Solved] DCNv2 Compile Error: error: identifier “THCudaBlas_SgemmBatched” is undefined
- [Solved] Pytoch nn.CrossEntropyLoss Error: RuntimeError: expected scalar type Long but found Float
- [Solved] RuntimeError: one_hot is only applicable to index tensor