Skip to content

Commit

Permalink
编码器教程代码更新
Browse files Browse the repository at this point in the history
  • Loading branch information
Grasshlw committed Sep 6, 2020
1 parent 230c7a1 commit eb6626f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docs/source/clock_driven/2_encoding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
import torch
import matplotlib
import matplotlib.pyplot as plt
import visualizing
import encoding
from spikingjelly.clock_driven import encoding
from spikingjelly import visualizing
# 给定脉冲序列
set_spike = torch.full((3, 5), 0, dtype=torch.bool)
Expand All @@ -67,7 +67,7 @@
plt.style.use(['science', 'muted'])
visualizing.plot_1d_spikes(out_spike.float().numpy(), 'PeriodicEncoder', 'Simulating Step', 'Neuron Index',
plot_spiking_rate=False)
plot_firing_rate=False)
plt.show()
.. image:: ../_static/tutorials/clock_driven/2_encoding/1.*
Expand Down Expand Up @@ -111,8 +111,8 @@
import torch
import matplotlib
import matplotlib.pyplot as plt
import visualizing
import encoding
from spikingjelly.clock_driven import encoding
from spikingjelly import visualizing
# 随机生成6个神经元的刺激强度,设定最大脉冲时间为20
x = torch.rand(6)
Expand All @@ -130,7 +130,7 @@
print(x)
plt.style.use(['science', 'muted'])
visualizing.plot_1d_spikes(out_spike.float().numpy(), 'LatencyEncoder', 'Simulating Step', 'Neuron Index',
plot_spiking_rate=False)
plot_firing_rate=False)
plt.show()
当随机生成的6个刺激强度分别为 ``0.6650`` 、 ``0.3704`` 、 ``0.8485`` 、 ``0.0247`` 、 ``0.5589`` 和 ``0.1030`` 时,得到的脉冲序列如下:
Expand All @@ -153,8 +153,8 @@
import matplotlib
import matplotlib.pyplot as plt
from PIL import Image
import visualizing
import encoding
from spikingjelly.clock_driven import encoding
from spikingjelly import visualizing
# 读入lena图像
lena_img = np.array(Image.open('lena512.bmp')) / 255
Expand Down

0 comments on commit eb6626f

Please sign in to comment.