Python tensorflow.python.ops.array_ops.broadcast_dynamic_shape() Examples

The following are 30 code examples of tensorflow.python.ops.array_ops.broadcast_dynamic_shape(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tensorflow.python.ops.array_ops , or try the search function .
Example #1
Source File: distribution_util.py    From lambda-packs with MIT License 6 votes vote down vote up
def prefer_static_broadcast_shape(
    shape1, shape2, name="prefer_static_broadcast_shape"):
  """Convenience function which statically broadcasts shape when possible.

  Args:
    shape1:  `1-D` integer `Tensor`.  Already converted to tensor!
    shape2:  `1-D` integer `Tensor`.  Already converted to tensor!
    name:  A string name to prepend to created ops.

  Returns:
    The broadcast shape, either as `TensorShape` (if broadcast can be done
      statically), or as a `Tensor`.
  """
  with ops.name_scope(name, values=[shape1, shape2]):
    if (tensor_util.constant_value(shape1) is not None and
        tensor_util.constant_value(shape2) is not None):
      return array_ops.broadcast_static_shape(
          tensor_shape.TensorShape(tensor_util.constant_value(shape1)),
          tensor_shape.TensorShape(tensor_util.constant_value(shape2)))
    return array_ops.broadcast_dynamic_shape(shape1, shape2) 
Example #2
Source File: inverse_gamma.py    From keras-lambda with MIT License 5 votes vote down vote up
def _batch_shape(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.alpha), array_ops.shape(self.beta)) 
Example #3
Source File: normal.py    From auto-alt-text-lambda-api with MIT License 5 votes vote down vote up
def _batch_shape(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.mu), array_ops.shape(self.sigma)) 
Example #4
Source File: von_mises_fisher.py    From s-vae-tf with MIT License 5 votes vote down vote up
def _batch_shape_tensor(self):
        return array_ops.broadcast_dynamic_shape(
            array_ops.shape(self._loc),
            array_ops.shape(self._scale)) 
Example #5
Source File: gamma.py    From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License 5 votes vote down vote up
def _batch_shape_tensor(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.concentration),
        array_ops.shape(self.rate)) 
Example #6
Source File: student_t.py    From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License 5 votes vote down vote up
def _batch_shape_tensor(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.df),
        array_ops.broadcast_dynamic_shape(
            array_ops.shape(self.loc), array_ops.shape(self.scale))) 
Example #7
Source File: uniform.py    From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License 5 votes vote down vote up
def _batch_shape_tensor(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.low),
        array_ops.shape(self.high)) 
Example #8
Source File: uniform.py    From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License 5 votes vote down vote up
def _cdf(self, x):
    broadcast_shape = array_ops.broadcast_dynamic_shape(
        array_ops.shape(x), self.batch_shape_tensor())
    zeros = array_ops.zeros(broadcast_shape, dtype=self.dtype)
    ones = array_ops.ones(broadcast_shape, dtype=self.dtype)
    broadcasted_x = x * ones
    result_if_not_big = array_ops.where(
        x < self.low, zeros, (broadcasted_x - self.low) / self.range())
    return array_ops.where(x >= self.high, ones, result_if_not_big) 
Example #9
Source File: laplace.py    From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License 5 votes vote down vote up
def _batch_shape_tensor(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.loc), array_ops.shape(self.scale)) 
Example #10
Source File: gamma.py    From keras-lambda with MIT License 5 votes vote down vote up
def _batch_shape(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.alpha), array_ops.shape(self.beta)) 
Example #11
Source File: binomial.py    From auto-alt-text-lambda-api with MIT License 5 votes vote down vote up
def _batch_shape(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.n), array_ops.shape(self.p)) 
Example #12
Source File: logistic.py    From keras-lambda with MIT License 5 votes vote down vote up
def _batch_shape(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.loc), array_ops.shape(self.scale)) 
Example #13
Source File: student_t.py    From keras-lambda with MIT License 5 votes vote down vote up
def _batch_shape(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.df),
        array_ops.broadcast_dynamic_shape(
            array_ops.shape(self.mu), array_ops.shape(self.sigma))) 
Example #14
Source File: gumbel.py    From keras-lambda with MIT License 5 votes vote down vote up
def _batch_shape(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.loc), array_ops.shape(self.scale)) 
Example #15
Source File: binomial.py    From keras-lambda with MIT License 5 votes vote down vote up
def _batch_shape(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.n), array_ops.shape(self.p)) 
Example #16
Source File: laplace.py    From keras-lambda with MIT License 5 votes vote down vote up
def _batch_shape(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.loc), array_ops.shape(self.scale)) 
Example #17
Source File: normal.py    From keras-lambda with MIT License 5 votes vote down vote up
def _batch_shape(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.mu), array_ops.shape(self.sigma)) 
Example #18
Source File: laplace.py    From auto-alt-text-lambda-api with MIT License 5 votes vote down vote up
def _batch_shape(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.loc), array_ops.shape(self.scale)) 
Example #19
Source File: gamma.py    From lambda-packs with MIT License 5 votes vote down vote up
def _batch_shape_tensor(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.concentration),
        array_ops.shape(self.rate)) 
Example #20
Source File: gumbel.py    From auto-alt-text-lambda-api with MIT License 5 votes vote down vote up
def _batch_shape(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.loc), array_ops.shape(self.scale)) 
Example #21
Source File: student_t.py    From auto-alt-text-lambda-api with MIT License 5 votes vote down vote up
def _batch_shape(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.df),
        array_ops.broadcast_dynamic_shape(
            array_ops.shape(self.mu), array_ops.shape(self.sigma))) 
Example #22
Source File: logistic.py    From auto-alt-text-lambda-api with MIT License 5 votes vote down vote up
def _batch_shape(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.loc), array_ops.shape(self.scale)) 
Example #23
Source File: inverse_gamma.py    From auto-alt-text-lambda-api with MIT License 5 votes vote down vote up
def _batch_shape(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.alpha), array_ops.shape(self.beta)) 
Example #24
Source File: gamma.py    From auto-alt-text-lambda-api with MIT License 5 votes vote down vote up
def _batch_shape(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.alpha), array_ops.shape(self.beta)) 
Example #25
Source File: linear_operator_udvh_update.py    From lambda-packs with MIT License 5 votes vote down vote up
def _shape_tensor(self):
    batch_shape = array_ops.broadcast_dynamic_shape(
        self.base_operator.batch_shape_tensor(),
        array_ops.shape(self.u)[:-2])
    return array_ops.concat(
        [batch_shape, self.base_operator.shape_tensor()[-2:]], axis=0) 
Example #26
Source File: binomial.py    From lambda-packs with MIT License 5 votes vote down vote up
def _batch_shape_tensor(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.total_count),
        array_ops.shape(self.probs)) 
Example #27
Source File: gumbel.py    From lambda-packs with MIT License 5 votes vote down vote up
def _batch_shape_tensor(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.loc), array_ops.shape(self.scale)) 
Example #28
Source File: logistic.py    From lambda-packs with MIT License 5 votes vote down vote up
def _batch_shape_tensor(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.loc), array_ops.shape(self.scale)) 
Example #29
Source File: inverse_gamma.py    From lambda-packs with MIT License 5 votes vote down vote up
def _batch_shape_tensor(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.concentration),
        array_ops.shape(self.rate)) 
Example #30
Source File: laplace.py    From lambda-packs with MIT License 5 votes vote down vote up
def _batch_shape_tensor(self):
    return array_ops.broadcast_dynamic_shape(
        array_ops.shape(self.loc), array_ops.shape(self.scale))