From 3ed1c5d0e4018fc70012a6209a859a059f7127b5 Mon Sep 17 00:00:00 2001 From: zhang Date: Fri, 25 Mar 2022 00:11:34 +0800 Subject: =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dl/bn/__init__.py | 0 dl/bn/np_demo.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 dl/bn/__init__.py create mode 100644 dl/bn/np_demo.py (limited to 'dl/bn') diff --git a/dl/bn/__init__.py b/dl/bn/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/dl/bn/np_demo.py b/dl/bn/np_demo.py new file mode 100644 index 0000000..9cd6296 --- /dev/null +++ b/dl/bn/np_demo.py @@ -0,0 +1,28 @@ + +import numpy as np +import matplotlib.pyplot as plt + + +batch = np.zeros([2, 3, 3, 3]) +batch[0, :, :, 0] = np.asarray([[2.4, 0.3, 5.6], + [7.2, 0.0, 2.1], + [1.9, 7.4, 4.1]]) +batch[0, :, :, 1] = np.asarray([[1.0, 2.1, 3.8], + [9.6, 2.0, 4.4], + [9.3, 3.9, 1.4]]) +batch[0, :, :, 2] = np.asarray([[2.6, 8.1, 9.0], + [2.2, 6.6, 0.2], + [6.3, 6.0, 0.1]]) + +batch[1, :, :, 0] = np.asarray([[5.1, 9.0, 6.9], + [9.7, 2.9, 2.4], + [6.2, 0.7, 4.3]]) +batch[1, :, :, 1] = np.asarray([[3.3, 7.9, 4.8], + [3.7, 2.0, 9.4], + [4.9, 2.1, 7.8]]) + +batch[1, :, :, 2] = np.asarray([[2.8, 5.4, 0.0], + [6.4, 1.8, 6.8], + [3.7, 5.6, 5.6]]) +print(batch[:, :, :, 0].mean()) +print(batch[:, :, :, 0].var()) \ No newline at end of file -- cgit v1.2.3