code: def read_memory(self):
          
          if self.mem_empty == True:
              if self.mem_idx == 0:
                  m_x = np.zeros(self.n)
                  m_d = 0
              else:
                  m_x = np.mean(self.mem_x[:self.mem_idx+1], axis=0)
                  m_d = np.mean(self.mem_d[:self.mem_idx])
          else:
              m_x = np.mean(self.mem_x, axis=0)
              m_d = np.mean(np.delete(self.mem_d, self.mem_idx))
          self.mem_idx += 1
          if self.mem_idx > len(self.mem_x)-1:
              self.mem_idx = 0
              self.mem_empty = False
          return m_d, m_x
docs: This function read mean value of target`d`
          and input vector `x` from history