Creates a dictionary representing the state of this position.
        Returns a dict object of the form:
178115
def to_dict(self):
        
        return {
            'sid': self.asset,
            'amount': self.amount,
            'cost_basis': self.cost_basis,
            'last_sale_price': self.last_sale_price
        }
1331319
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'status') and self.status is not None:
            _dict['status'] = self.status
        return _dict
710912
def to_dict(self) -> dict:
        
        return {
            key: getattr(self, key)
            for key in self.__slots__
            if getattr(self, key) is not None
        }
1068460
def to_dict(self):
        ""
        ndict = {}
        for key, val in self.__dict__.items():
            if key[0] == "_":
                ndict[key[1:]] = val
            else:
                ndict[key] = val
        return ndict
1319884
def state_dict(self) -> Dict[str, Any]:
        
        return {
                "best_so_far": self._best_so_far,
                "patience": self._patience,
                "epochs_with_no_improvement": self._epochs_with_no_improvement,
                "is_best_so_far": self._is_best_so_far,
                "should_decrease": self._should_decrease,
                "best_epoch_metrics": self.best_epoch_metrics,
                "epoch_number": self._epoch_number,
                "best_epoch": self.best_epoch
        }
1079099
def dict(self):
        
        return_obj = {}
        for attr in dir(self):
            if not attr.startswith('__') and attr not in self.__reserved:
                if isinstance(getattr(self, attr), list):
                    return_val = []
                    for item in getattr(self, attr):
                        if isinstance(item, DictClass):
                            return_val.append(dict(item))
                        else:
                            return_val.append(item)
                elif isinstance(getattr(self, attr), dict):
                    return_val = {}
                    for key, item in getattr(self, attr).items():
                        if isinstance(item, DictClass):
                            return_val[key] = item.dict()
                        else:
                            return_val[key] = item
                elif isinstance(getattr(self, attr), DictClass):
                    return_val = getattr(self, attr).dict()
                else:
                    return_val = getattr(self, attr)
                return_obj[attr] = return_val
        return return_obj
952852
def as_dict(self) -> Dict[str, str]:
        
        items: Dict[str, str] = {}

        for k, v in self.items():

            if type(v) is str:
                items.update({k: v})

        return items
1229263
def current_state(self):
        """"""
        state = {}
        for s in self._state:
            state[s] = getattr(self, s)
        return state
194566
def to_dict(self):
        
        return {
            'mean': self.mean,
            'var': self.var,
            'min': self.min,
            'max': self.max,
            'num': self.num
        }
1030840
def to_dict(self):
        
        return {
            "state_size": self.state_size,
            "chain": self.chain.to_json(),
            "parsed_sentences": self.parsed_sentences if self.retain_original else None
        }
773248
def get_state(self):
        
        D = {}
        for key in self._state_props:
            D[key] = getattr(self, key)
        return D
540199
def to_dict(self):
        
        return {'type': self.__class__.__name__,
                'points': self.points.tolist(),
                'knots': self.knots.tolist(),
                'closed': self.closed}
28294
def _to_dict(self):
        """"""
        _dict = {}
        if hasattr(self, 'text') and self.text is not None:
            _dict['text'] = self.text
        if hasattr(self, 'location') and self.location is not None:
            _dict['location'] = self.location._to_dict()
        if hasattr(self, 'level') and self.level is not None:
            _dict['level'] = self.level
        if hasattr(self,
                   'element_locations') and self.element_locations is not None:
            _dict['element_locations'] = [
                x._to_dict() for x in self.element_locations
            ]
        return _dict
415544
def to_dict(self):
        
        return dict((k, str(self.get(k))) for k in self.raw_dict)
939097
def to_dict(self):
        

        stage_desc_as_dict = {

            'uid': self._uid,
            'name': self._name,
            'state': self._state,
            'state_history': self._state_history,
            'parent_pipeline': self._p_pipeline
        }

        return stage_desc_as_dict
1264285
def state_dict(self) -> dict:
        
        hidden_state = {}

        if self.optimizer is not None:
            hidden_state['optimizer'] = self.optimizer.state_dict()

        for callback in self.callbacks:
            callback.write_state_dict(self.training_info, hidden_state)

        return hidden_state
20154
def load_state_dict(self, state_dict: Dict[str, Any]) -> None:
        
        self.__dict__.update(state_dict)