diff options
Diffstat (limited to 'tensorflow/python/ops/math_ops.py')
-rw-r--r-- | tensorflow/python/ops/math_ops.py | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/tensorflow/python/ops/math_ops.py b/tensorflow/python/ops/math_ops.py index 4a2473cae5..29c2fcf432 100644 --- a/tensorflow/python/ops/math_ops.py +++ b/tensorflow/python/ops/math_ops.py @@ -1,3 +1,18 @@ +# Copyright 2015 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== + """## Arithmetic Operators TensorFlow provides several operations that you can use to add basic arithmetic @@ -7,6 +22,8 @@ operators to your graph. @@sub @@mul @@div +@@truediv +@@floordiv @@mod ## Basic Math Functions @@ -477,13 +494,13 @@ def truediv(x, y, name=None): def floordiv(x, y, name=None): """Divides `x / y` elementwise, rounding down for floating point. - The same as `tf.div(x,y)`, but uses `tf.floor(tf.div(x,y))` for floating - point arguments so that the result is always an integer (though possibly an - integer represented as floating point). This op is generated by `x // y` - floor division in Python 3 and in Python 2.7 with + The same as `tf.div(x,y)` for integers, but uses `tf.floor(tf.div(x,y))` for + floating point arguments so that the result is always an integer (though + possibly an integer represented as floating point). This op is generated by + `x // y` floor division in Python 3 and in Python 2.7 with `from __future__ import division`. - Note that for efficiency, __floordiv__ uses C semantics for negative numbers + Note that for efficiency, `floordiv` uses C semantics for negative numbers (unlike Python and Numpy). `x` and `y` must have the same type, and the result will have the same type @@ -491,11 +508,11 @@ def floordiv(x, y, name=None): Args: x: `Tensor` numerator of real numeric type. - y: `Tensor` numerator of real numeric type. + y: `Tensor` denominator of real numeric type. name: A name for the operation (optional). Returns: - `x / y` rounded down (except possibly for integers in C). + `x / y` rounded down (except possibly towards zero for negative integers). Raises: TypeError: If the inputs are complex. |