MCPcopy
hub / github.com/dmlc/dgl / __setitem__

Method __setitem__

python/dgl/view.py:210–227  ·  view source on GitHub ↗
(self, key, val)

Source from the content-addressed store, hash-verified

208 return self._graph._get_e_repr(self._etid, self._edges)[key]
209
210 def __setitem__(self, key, val):
211 if isinstance(val, LazyFeature):
212 self._graph._edge_frames[self._etid][key] = val
213 elif isinstance(self._etype, list):
214 assert isinstance(val, dict), (
215 "Current HeteroEdgeDataView has multiple edge types, "
216 "please pass the edge type and the corresponding data through a dict."
217 )
218
219 for (etype, data) in val.items():
220 etid = self._graph.get_etype_id(etype)
221 self._graph._set_e_repr(etid, self._edges, {key: data})
222 else:
223 assert isinstance(val, dict) is False, (
224 "The HeteroEdgeDataView has only one edge type. "
225 "please pass a tensor directly"
226 )
227 self._graph._set_e_repr(self._etid, self._edges, {key: val})
228
229 def __delitem__(self, key):
230 if isinstance(self._etype, list):

Callers

nothing calls this directly

Calls 3

_set_e_reprMethod · 0.80
itemsMethod · 0.45
get_etype_idMethod · 0.45

Tested by

no test coverage detected