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

Function round

tensorflow/python/ops/math_ops.py:620–643  ·  view source on GitHub ↗

Rounds the values of a tensor to the nearest integer, element-wise. Rounds half to even. Also known as bankers rounding. If you want to round according to the current system rounding mode use tf::cint. For example: ```python x = tf.constant([0.9, 2.5, 2.3, 1.5, -4.5]) tf.round(x) # [

(x, name=None)

Source from the content-addressed store, hash-verified

618@tf_export("math.round", "round")
619@dispatch.add_dispatch_support
620def round(x, name=None): # pylint: disable=redefined-builtin
621 """Rounds the values of a tensor to the nearest integer, element-wise.
622
623 Rounds half to even. Also known as bankers rounding. If you want to round
624 according to the current system rounding mode use tf::cint.
625 For example:
626
627 ```python
628 x = tf.constant([0.9, 2.5, 2.3, 1.5, -4.5])
629 tf.round(x) # [ 1.0, 2.0, 2.0, 2.0, -4.0 ]
630 ```
631
632 Args:
633 x: A `Tensor` of type `float16`, `float32`, `float64`, `int32`, or `int64`.
634 name: A name for the operation (optional).
635
636 Returns:
637 A `Tensor` of same shape and type as `x`.
638 """
639 x = ops.convert_to_tensor(x, name="x")
640 if x.dtype.is_integer:
641 return x
642 else:
643 return gen_math_ops.round(x, name=name)
644
645
646@tf_export("cast", "dtypes.cast")

Callers 8

_optimizeFunction · 0.50
create_dir_testFunction · 0.50
create_object_testFunction · 0.50
MainFunction · 0.50
_get_dump_file_pathFunction · 0.50
NormalizeNumberFieldsFunction · 0.50
wav_to_featuresFunction · 0.50

Calls

no outgoing calls

Tested by 1

_get_dump_file_pathFunction · 0.40