def _uniform_full_int(self, shape, dtype, name=None):
     return gen_stateful_random_ops.stateful_uniform_full_int(
         self.state.handle,
         self.algorithm,
         shape=shape,
         dtype=dtype,
         name=name)
Пример #2
0
 def _uniform_full_int(self, shape, dtype, name=None):
   if compat.forward_compatible(2020, 10, 25):
     key, counter = self._prepare_key_counter(shape)
     return gen_stateless_random_ops_v2.stateless_random_uniform_full_int_v2(
         shape=shape,
         key=key,
         counter=counter,
         dtype=dtype,
         alg=self.algorithm,
         name=name)
   return gen_stateful_random_ops.stateful_uniform_full_int(
       self.state.handle, self.algorithm, shape=shape,
       dtype=dtype, name=name)
Пример #3
0
  def uniform_full_int(self, shape, dtype=dtypes.uint64, name=None):
    """Uniform distribution on an integer type's entire range.

    The other method `uniform` only covers the range [minval, maxval), which
    cannot be `dtype`'s full range because `maxval` is of type `dtype`.

    Args:
      shape: the shape of the output.
      dtype: (optional) the integer type, default to uint64.
      name: (optional) the name of the node.

    Returns:
      A tensor of random numbers of the required shape.
    """
    dtype = dtypes.as_dtype(dtype)
    with ops.name_scope(name, "stateful_uniform_full_int",
                        [shape]) as name:
      shape = _shape_tensor(shape)
      return gen_stateful_random_ops.stateful_uniform_full_int(
          self.state.handle, self.algorithm, shape=shape,
          dtype=dtype, name=name)