MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / merge

Method merge

tensorflow/python/ops/distributions/bijector_impl.py:77–106  ·  view source on GitHub ↗

Returns new _Mapping with args merged with self. Args: x: `Tensor`. Forward. y: `Tensor`. Inverse. ildj_map: `Dictionary`. This is a mapping from event_ndims to a `Tensor` representing the inverse log det jacobian. kwargs: Python dictionary. Extra args supplied t

(self, x=None, y=None, ildj_map=None, kwargs=None, mapping=None)

Source from the content-addressed store, hash-verified

75 self._deep_tuple(tuple(sorted(self.kwargs.items()))))
76
77 def merge(self, x=None, y=None, ildj_map=None, kwargs=None, mapping=None):
78 """Returns new _Mapping with args merged with self.
79
80 Args:
81 x: `Tensor`. Forward.
82 y: `Tensor`. Inverse.
83 ildj_map: `Dictionary`. This is a mapping from event_ndims to a `Tensor`
84 representing the inverse log det jacobian.
85 kwargs: Python dictionary. Extra args supplied to
86 forward/inverse/etc functions.
87 mapping: Instance of _Mapping to merge. Can only be specified if no other
88 arg is specified.
89
90 Returns:
91 mapping: New instance of `_Mapping` which has inputs merged with self.
92
93 Raises:
94 ValueError: if mapping and any other arg is not `None`.
95 """
96 if mapping is None:
97 mapping = _Mapping(x=x, y=y, ildj_map=ildj_map, kwargs=kwargs)
98 elif any(arg is not None for arg in [x, y, ildj_map, kwargs]):
99 raise ValueError("Cannot simultaneously specify mapping and individual "
100 "arguments.")
101
102 return _Mapping(
103 x=self._merge(self.x, mapping.x),
104 y=self._merge(self.y, mapping.y),
105 ildj_map=self._merge_dicts(self.ildj_map, mapping.ildj_map),
106 kwargs=self._merge(self.kwargs, mapping.kwargs))
107
108 def _merge_dicts(self, old=None, new=None):
109 """Helper to merge two dictionaries."""

Callers 7

mergeFunction · 0.45
_call_forwardMethod · 0.45
_call_inverseMethod · 0.45
_cacheMethod · 0.45

Calls 4

_mergeMethod · 0.95
_merge_dictsMethod · 0.95
_MappingClass · 0.85
anyFunction · 0.85

Tested by

no test coverage detected