-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathbatch_data.py
More file actions
34 lines (29 loc) · 1.16 KB
/
Copy pathbatch_data.py
File metadata and controls
34 lines (29 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""ニューラルネットワーク計算用のキュー。
"""
from typing import List, Tuple
import numpy as np
class BatchQueue:
"""ミニバッチデータを保持するキュー。
"""
def __init__(self):
"""BatchQueueクラスのコンストラクタ。
"""
self.input_plane = []
self.path = []
self.node_index = []
def push(self, input_plane: np.ndarray, path: List[Tuple[int, int]], node_index: int) -> None:
"""キューにデータをプッシュする。
Args:
input_plane (np.array): ニューラルネットワークへの入力データ。
path (List[Tuple[int, int]]): ルートから評価ノードへまでの経路。
node_index (int): ニューラルネットワークが評価する局面に対応するノードのインデックス。
"""
self.input_plane.append(input_plane)
self.path.append(path)
self.node_index.append(node_index)
def clear(self) -> None:
"""キューのデータを全て削除する。
"""
self.input_plane = []
self.path = []
self.node_index = []