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

Method _log_prob

tensorflow/python/ops/distributions/bernoulli.py:132–152  ·  view source on GitHub ↗
(self, event)

Source from the content-addressed store, hash-verified

130 return math_ops.cast(sample, self.dtype)
131
132 def _log_prob(self, event):
133 if self.validate_args:
134 event = distribution_util.embed_check_integer_casting_closed(
135 event, target_dtype=dtypes.bool)
136
137 # TODO(jaana): The current sigmoid_cross_entropy_with_logits has
138 # inconsistent behavior for logits = inf/-inf.
139 event = math_ops.cast(event, self.logits.dtype)
140 logits = self.logits
141 # sigmoid_cross_entropy_with_logits doesn't broadcast shape,
142 # so we do this here.
143
144 def _broadcast(logits, event):
145 return (array_ops.ones_like(event) * logits,
146 array_ops.ones_like(logits) * event)
147
148 if not (event.get_shape().is_fully_defined() and
149 logits.get_shape().is_fully_defined() and
150 event.get_shape() == logits.get_shape()):
151 logits, event = _broadcast(logits, event)
152 return -nn.sigmoid_cross_entropy_with_logits(labels=event, logits=logits)
153
154 def _entropy(self):
155 return (-self.logits * (math_ops.sigmoid(self.logits) - 1) +

Callers

nothing calls this directly

Calls 3

is_fully_definedMethod · 0.80
castMethod · 0.45
get_shapeMethod · 0.45

Tested by

no test coverage detected