Revision 12cd680cc614ed8aade4956a430e288e05425e78 authored by Yijie Tang on 10 April 2024, 13:52:17 UTC, committed by Yijie Tang on 10 April 2024, 13:52:17 UTC
1 parent 5934d01
Raw File
SharedData.py
import torch
import copy

from model.scene_rep import JointEncoding


class SharedData():
    def __init__(self, config, SLAM):
        self.config = config
        self.slam = SLAM
        self.device = self.slam.device

        self.shared_model = None
        self.shared_model_flag = torch.zeros((1, )).share_memory_()  # 0: nothing; 1: active_2_inactive; -1: inactive_2_active


    def send_model_a2i(self, model):
        self.shared_model = copy.deepcopy(model).to(self.device).share_memory()
        self.shared_model_flag[0] = 1

    def send_model_i2a(self, model):
        self.shared_model = copy.deepcopy(model).to(self.device).share_memory()
        self.shared_model_flag[0] = -1
back to top