diff options
Diffstat (limited to 'tensorflow/docs_src/community/style_guide.md')
-rw-r--r-- | tensorflow/docs_src/community/style_guide.md | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/tensorflow/docs_src/community/style_guide.md b/tensorflow/docs_src/community/style_guide.md index a2df61bc80..767e33c3d0 100644 --- a/tensorflow/docs_src/community/style_guide.md +++ b/tensorflow/docs_src/community/style_guide.md @@ -115,31 +115,31 @@ Example: def my_op(tensor_in, other_tensor_in, my_param, other_param=0.5, output_collections=(), name=None): - """My operation that adds two tensors with given coefficients. - - Args: - tensor_in: `Tensor`, input tensor. - other_tensor_in: `Tensor`, same shape as `tensor_in`, other input tensor. - my_param: `float`, coefficient for `tensor_in`. - other_param: `float`, coefficient for `other_tensor_in`. - output_collections: `tuple` of `string`s, name of the collection to - collect result of this op. - name: `string`, name of the operation. - - Returns: - `Tensor` of same shape as `tensor_in`, sum of input values with coefficients. - - Example: - >>> my_op([1., 2.], [3., 4.], my_param=0.5, other_param=0.6, - output_collections=['MY_OPS'], name='add_t1t2') - [2.3, 3.4] - """ - with tf.name_scope(name, "my_op", [tensor_in, other_tensor_in]): - tensor_in = tf.convert_to_tensor(tensor_in) - other_tensor_in = tf.convert_to_tensor(other_tensor_in) - result = my_param * tensor_in + other_param * other_tensor_in - tf.add_to_collections(output_collections, result) - return result + """My operation that adds two tensors with given coefficients. + + Args: + tensor_in: `Tensor`, input tensor. + other_tensor_in: `Tensor`, same shape as `tensor_in`, other input tensor. + my_param: `float`, coefficient for `tensor_in`. + other_param: `float`, coefficient for `other_tensor_in`. + output_collections: `tuple` of `string`s, name of the collection to + collect result of this op. + name: `string`, name of the operation. + + Returns: + `Tensor` of same shape as `tensor_in`, sum of input values with coefficients. + + Example: + >>> my_op([1., 2.], [3., 4.], my_param=0.5, other_param=0.6, + output_collections=['MY_OPS'], name='add_t1t2') + [2.3, 3.4] + """ + with tf.name_scope(name, "my_op", [tensor_in, other_tensor_in]): + tensor_in = tf.convert_to_tensor(tensor_in) + other_tensor_in = tf.convert_to_tensor(other_tensor_in) + result = my_param * tensor_in + other_param * other_tensor_in + tf.add_to_collection(output_collections, result) + return result Usage: |