引数の設定
python,pytorch初心者です。
pythonのコードで書かれたマルチエージェントシステムのプログラムをpytorch用に変更したのですがエラーが発生してしまいます。
引数に関することなのはわかるのですがどの_init__の引数を変更すればよいのかわかりません。
エラーメッセージ
TypeError: __init__() missing 1 required positional argument: 'params'
コード
pytorch
1class Walls: 2 def __init__(self, x0, y0, x1, y1): 3 self.x = [[x0, y0], [x1, y1]] 4 self.area = 0.0 5 6class Particles: 7 def __init__(self, dh, wall): 8 self.box = wall.get_box() 9 self.dh = dh 10 self.size = 0 11 self.area = 0 12 13class ParticleEnv: 14 def __init__(self, dh, wall): 15 self.par = Particles(dh, wall) 16 self.wall = wall 17 self.num_state = DEF_NUM_STATE 18 self.state_dim = DEF_STATE_DIM + 1 19 self.obs_size = self.num_state*self.state_dim 20 self.num_accel = DEF_NUM_ACCEL 21 self.num_dir = DEF_NUM_DIR 22 self.accel = [2.0, 1.0, 0.5] 23 self.dir_ang = np.zeros(self.num_dir) 24 for i in range(1,self.num_dir): 25 self.dir_ang[i] = DEF_DIR_ANG*i 26 self.num_action = self.num_dir * self.num_accel + 1 27 28

回答1件
あなたの回答
tips
プレビュー