@@ -46,29 +46,31 @@ public class BitwiseOps(
4646 public val scope: Scope = ops.scope
4747
4848 /* *
49- * Elementwise computes the bitwise AND of ``` x``` and ``` y```.
50- * The result will have those bits set, that are set in both ``` x``` and ``` y```. The
51- * computation is performed on the underlying representations of ``` x``` and ``` y```.
52- * For example:
49+ * Elementwise computes the bitwise AND of `x` and `y`.
50+ * The result will have those bits set, that are set in both `x` and `y`. The
51+ * computation is performed on the underlying representations of `x` and `y`.
5352 *
54- * import tensorflow as tf
53+ * For example:
54+ * ```
55+ * import tensorflow as tf
5556 * from tensorflow.python.ops import bitwise_ops
56- * dtype_list = [ tf.int8, tf.int16, tf.int32, tf.int64,
57+ * dtype_list = [ tf.int8, tf.int16, tf.int32, tf.int64,
5758 * tf.uint8, tf.uint16, tf.uint32, tf.uint64]
5859 *
5960 * for dtype in dtype_list:
60- * lhs = tf.constant([ 0, 5, 3, 14], dtype=dtype)
61- * rhs = tf.constant([ 5, 0, 7, 11], dtype=dtype)
62- * exp = tf.constant([ 0, 0, 3, 10], dtype=tf.float32)
61+ * lhs = tf.constant([ 0, 5, 3, 14], dtype=dtype)
62+ * rhs = tf.constant([ 5, 0, 7, 11], dtype=dtype)
63+ * exp = tf.constant([ 0, 0, 3, 10], dtype=tf.float32)
6364 *
6465 * res = bitwise_ops.bitwise_and(lhs, rhs)
6566 * tf.assert_equal(tf.cast(res, tf.float32), exp) # TRUE
6667 *
68+ * ```
6769 *
68- * @param T data type for ` z` output
70+ * @param <T> data type for `z` output
6971 * @param x the x value
7072 * @param y the y value
71- * @param T data type for ` BitwiseAnd` output and operands
73+ * @param <T> data type for `BitwiseAnd` output and operands
7274 * @return a new instance of BitwiseAnd
7375 * @see org.tensorflow.op.BitwiseOps.bitwiseAnd
7476 */
@@ -79,29 +81,31 @@ public class BitwiseOps(
7981 )
8082
8183 /* *
82- * Elementwise computes the bitwise OR of ``` x``` and ``` y```.
83- * The result will have those bits set, that are set in ``` x```, ``` y``` or both. The
84- * computation is performed on the underlying representations of ``` x``` and ``` y```.
85- * For example:
84+ * Elementwise computes the bitwise OR of `x` and `y`.
85+ * The result will have those bits set, that are set in `x`, `y` or both. The
86+ * computation is performed on the underlying representations of `x` and `y`.
8687 *
87- * import tensorflow as tf
88+ * For example:
89+ * ```
90+ * import tensorflow as tf
8891 * from tensorflow.python.ops import bitwise_ops
89- * dtype_list = [ tf.int8, tf.int16, tf.int32, tf.int64,
92+ * dtype_list = [ tf.int8, tf.int16, tf.int32, tf.int64,
9093 * tf.uint8, tf.uint16, tf.uint32, tf.uint64]
9194 *
9295 * for dtype in dtype_list:
93- * lhs = tf.constant([ 0, 5, 3, 14], dtype=dtype)
94- * rhs = tf.constant([ 5, 0, 7, 11], dtype=dtype)
95- * exp = tf.constant([ 5, 5, 7, 15], dtype=tf.float32)
96+ * lhs = tf.constant([ 0, 5, 3, 14], dtype=dtype)
97+ * rhs = tf.constant([ 5, 0, 7, 11], dtype=dtype)
98+ * exp = tf.constant([ 5, 5, 7, 15], dtype=tf.float32)
9699 *
97100 * res = bitwise_ops.bitwise_or(lhs, rhs)
98101 * tf.assert_equal(tf.cast(res, tf.float32), exp) # TRUE
99102 *
103+ * ```
100104 *
101- * @param T data type for ` z` output
105+ * @param <T> data type for `z` output
102106 * @param x the x value
103107 * @param y the y value
104- * @param T data type for ` BitwiseOr` output and operands
108+ * @param <T> data type for `BitwiseOr` output and operands
105109 * @return a new instance of BitwiseOr
106110 * @see org.tensorflow.op.BitwiseOps.bitwiseOr
107111 */
@@ -112,29 +116,31 @@ public class BitwiseOps(
112116 )
113117
114118 /* *
115- * Elementwise computes the bitwise XOR of ``` x``` and ``` y```.
116- * The result will have those bits set, that are different in ``` x``` and ``` y```. The
117- * computation is performed on the underlying representations of ``` x``` and ``` y```.
118- * For example:
119+ * Elementwise computes the bitwise XOR of `x` and `y`.
120+ * The result will have those bits set, that are different in `x` and `y`. The
121+ * computation is performed on the underlying representations of `x` and `y`.
119122 *
120- * import tensorflow as tf
123+ * For example:
124+ * ```
125+ * import tensorflow as tf
121126 * from tensorflow.python.ops import bitwise_ops
122- * dtype_list = [ tf.int8, tf.int16, tf.int32, tf.int64,
127+ * dtype_list = [ tf.int8, tf.int16, tf.int32, tf.int64,
123128 * tf.uint8, tf.uint16, tf.uint32, tf.uint64]
124129 *
125130 * for dtype in dtype_list:
126- * lhs = tf.constant([ 0, 5, 3, 14], dtype=dtype)
127- * rhs = tf.constant([ 5, 0, 7, 11], dtype=dtype)
128- * exp = tf.constant([ 5, 5, 4, 5], dtype=tf.float32)
131+ * lhs = tf.constant([ 0, 5, 3, 14], dtype=dtype)
132+ * rhs = tf.constant([ 5, 0, 7, 11], dtype=dtype)
133+ * exp = tf.constant([ 5, 5, 4, 5], dtype=tf.float32)
129134 *
130135 * res = bitwise_ops.bitwise_xor(lhs, rhs)
131136 * tf.assert_equal(tf.cast(res, tf.float32), exp) # TRUE
132137 *
138+ * ```
133139 *
134- * @param T data type for ` z` output
140+ * @param <T> data type for `z` output
135141 * @param x the x value
136142 * @param y the y value
137- * @param T data type for ` BitwiseXor` output and operands
143+ * @param <T> data type for `BitwiseXor` output and operands
138144 * @return a new instance of BitwiseXor
139145 * @see org.tensorflow.op.BitwiseOps.bitwiseXor
140146 */
@@ -145,51 +151,53 @@ public class BitwiseOps(
145151 )
146152
147153 /* *
148- * Invert (flip) each bit of supported types; for example, type ``` uint8``` value 01010101
149- * becomes 10101010.
150- * Flip each bit of supported types. For example, type ``` int8`` ` (decimal 2) binary 00000010
154+ * Invert (flip) each bit of supported types; for example, type `uint8` value 01010101 becomes
155+ * 10101010.
156+ * Flip each bit of supported types. For example, type `int8` (decimal 2) binary 00000010
151157 * becomes (decimal -3) binary 11111101.
152- * This operation is performed on each element of the tensor argument ``` x```.
153- * Example:
158+ * This operation is performed on each element of the tensor argument `x`.
154159 *
155- * import tensorflow as tf
160+ * Example:
161+ * ```
162+ * import tensorflow as tf
156163 * from tensorflow.python.ops import bitwise_ops
157164 *
158165 * # flip 2 (00000010) to -3 (11111101)
159166 * tf.assert_equal(-3, bitwise_ops.invert(2))
160167 *
161- * dtype_list = [ dtypes.int8, dtypes.int16, dtypes.int32, dtypes.int64,
168+ * dtype_list = [ dtypes.int8, dtypes.int16, dtypes.int32, dtypes.int64,
162169 * dtypes.uint8, dtypes.uint16, dtypes.uint32, dtypes.uint64]
163170 *
164- * inputs = [ 0, 5, 3, 14]
171+ * inputs = [ 0, 5, 3, 14]
165172 * for dtype in dtype_list:
166173 * # Because of issues with negative numbers, let's test this indirectly.
167174 * # 1. invert(a) and a = 0
168175 * # 2. invert(a) or a = invert(0)
169- * input_tensor = tf.constant([ 0, 5, 3, 14], dtype=dtype)
170- * not_a_and_a, not_a_or_a, not_0 = [ bitwise_ops.bitwise_and(
176+ * input_tensor = tf.constant([ 0, 5, 3, 14], dtype=dtype)
177+ * not_a_and_a, not_a_or_a, not_0 = [ bitwise_ops.bitwise_and(
171178 * input_tensor, bitwise_ops.invert(input_tensor)),
172179 * bitwise_ops.bitwise_or(
173180 * input_tensor, bitwise_ops.invert(input_tensor)),
174181 * bitwise_ops.invert(
175182 * tf.constant(0, dtype=dtype))]
176183 *
177- * expected = tf.constant([ 0, 0, 0, 0], dtype=tf.float32)
184+ * expected = tf.constant([ 0, 0, 0, 0], dtype=tf.float32)
178185 * tf.assert_equal(tf.cast(not_a_and_a, tf.float32), expected)
179186 *
180- * expected = tf.cast([ not_0] * 4, tf.float32)
187+ * expected = tf.cast([ not_0] * 4, tf.float32)
181188 * tf.assert_equal(tf.cast(not_a_or_a, tf.float32), expected)
182189 *
183190 * # For unsigned dtypes let's also check the result directly.
184191 * if dtype.is_unsigned:
185192 * inverted = bitwise_ops.invert(input_tensor)
186- * expected = tf.constant([ dtype.max - x for x in inputs], dtype=tf.float32)
193+ * expected = tf.constant([ dtype.max - x for x in inputs], dtype=tf.float32)
187194 * tf.assert_equal(tf.cast(inverted, tf.float32), tf.cast(expected, tf.float32))
188195 *
196+ * ```
189197 *
190- * @param T data type for ` y` output
198+ * @param <T> data type for `y` output
191199 * @param x the x value
192- * @param T data type for ` Invert` output and operands
200+ * @param <T> data type for `Invert` output and operands
193201 * @return a new instance of Invert
194202 * @see org.tensorflow.op.BitwiseOps.invert
195203 */
@@ -198,41 +206,42 @@ public class BitwiseOps(
198206 )
199207
200208 /* *
201- * Elementwise computes the bitwise left-shift of ``` x``` and ``` y`` `.
202- * If ``` y``` is negative, or greater than or equal to the width of ``` x`` ` in bits the
209+ * Elementwise computes the bitwise left-shift of `x` and `y `.
210+ * If `y` is negative, or greater than or equal to the width of `x ` in bits the
203211 * result is implementation defined.
204- * Example:
205212 *
206- * import tensorflow as tf
213+ * Example:
214+ * ```
215+ * import tensorflow as tf
207216 * from tensorflow.python.ops import bitwise_ops
208217 * import numpy as np
209- * dtype_list = [ tf.int8, tf.int16, tf.int32, tf.int64]
218+ * dtype_list = [ tf.int8, tf.int16, tf.int32, tf.int64]
210219 *
211220 * for dtype in dtype_list:
212- * lhs = tf.constant([ -1, -5, -3, -14], dtype=dtype)
213- * rhs = tf.constant([ 5, 0, 7, 11], dtype=dtype)
221+ * lhs = tf.constant([ -1, -5, -3, -14], dtype=dtype)
222+ * rhs = tf.constant([ 5, 0, 7, 11], dtype=dtype)
214223 *
215224 * left_shift_result = bitwise_ops.left_shift(lhs, rhs)
216225 *
217226 * print(left_shift_result)
218227 *
219228 * # This will print:
220- * # tf.Tensor([ -32 -5 -128 0], shape=(4,), dtype=int8)
221- * # tf.Tensor([ -32 -5 -384 -28672], shape=(4,), dtype=int16)
222- * # tf.Tensor([ -32 -5 -384 -28672], shape=(4,), dtype=int32)
223- * # tf.Tensor([ -32 -5 -384 -28672], shape=(4,), dtype=int64)
229+ * # tf.Tensor([ -32 -5 -128 0], shape=(4,), dtype=int8)
230+ * # tf.Tensor([ -32 -5 -384 -28672], shape=(4,), dtype=int16)
231+ * # tf.Tensor([ -32 -5 -384 -28672], shape=(4,), dtype=int32)
232+ * # tf.Tensor([ -32 -5 -384 -28672], shape=(4,), dtype=int64)
224233 *
225- * lhs = np.array([ -2, 64, 101, 32], dtype=np.int8)
226- * rhs = np.array([ -1, -5, -3, -14], dtype=np.int8)
234+ * lhs = np.array([ -2, 64, 101, 32], dtype=np.int8)
235+ * rhs = np.array([ -1, -5, -3, -14], dtype=np.int8)
227236 * bitwise_ops.left_shift(lhs, rhs)
228- * # <tf.Tensor: shape=(4,), dtype=int8, numpy=array([ -2, 64, 101, 32],
229- * dtype=int8)>
237+ * # <tf.Tensor: shape=(4,), dtype=int8, numpy=array([ -2, 64, 101, 32], dtype=int8)>
230238 *
239+ * ```
231240 *
232- * @param T data type for ` z` output
241+ * @param <T> data type for `z` output
233242 * @param x the x value
234243 * @param y the y value
235- * @param T data type for ` LeftShift` output and operands
244+ * @param <T> data type for `LeftShift` output and operands
236245 * @return a new instance of LeftShift
237246 * @see org.tensorflow.op.BitwiseOps.leftShift
238247 */
@@ -243,43 +252,45 @@ public class BitwiseOps(
243252 )
244253
245254 /* *
246- * Elementwise computes the bitwise right-shift of ``` x``` and ``` y`` `.
255+ * Elementwise computes the bitwise right-shift of `x` and `y `.
247256 * Performs a logical shift for unsigned integer types, and an arithmetic shift
248257 * for signed integer types.
249- * If ``` y``` is negative, or greater than or equal to than the width of ``` x``` in bits
258+ *
259+ * If `y` is negative, or greater than or equal to than the width of `x` in bits
250260 * the result is implementation defined.
251- * Example:
252261 *
253- * import tensorflow as tf
262+ * Example:
263+ * ```
264+ * import tensorflow as tf
254265 * from tensorflow.python.ops import bitwise_ops
255266 * import numpy as np
256- * dtype_list = [ tf.int8, tf.int16, tf.int32, tf.int64]
267+ * dtype_list = [ tf.int8, tf.int16, tf.int32, tf.int64]
257268 *
258269 * for dtype in dtype_list:
259- * lhs = tf.constant([ -1, -5, -3, -14], dtype=dtype)
260- * rhs = tf.constant([ 5, 0, 7, 11], dtype=dtype)
270+ * lhs = tf.constant([ -1, -5, -3, -14], dtype=dtype)
271+ * rhs = tf.constant([ 5, 0, 7, 11], dtype=dtype)
261272 *
262273 * right_shift_result = bitwise_ops.right_shift(lhs, rhs)
263274 *
264275 * print(right_shift_result)
265276 *
266277 * # This will print:
267- * # tf.Tensor([ -1 -5 -1 -1], shape=(4,), dtype=int8)
268- * # tf.Tensor([ -1 -5 -1 -1], shape=(4,), dtype=int16)
269- * # tf.Tensor([ -1 -5 -1 -1], shape=(4,), dtype=int32)
270- * # tf.Tensor([ -1 -5 -1 -1], shape=(4,), dtype=int64)
278+ * # tf.Tensor([ -1 -5 -1 -1], shape=(4,), dtype=int8)
279+ * # tf.Tensor([ -1 -5 -1 -1], shape=(4,), dtype=int16)
280+ * # tf.Tensor([ -1 -5 -1 -1], shape=(4,), dtype=int32)
281+ * # tf.Tensor([ -1 -5 -1 -1], shape=(4,), dtype=int64)
271282 *
272- * lhs = np.array([ -2, 64, 101, 32], dtype=np.int8)
273- * rhs = np.array([ -1, -5, -3, -14], dtype=np.int8)
283+ * lhs = np.array([ -2, 64, 101, 32], dtype=np.int8)
284+ * rhs = np.array([ -1, -5, -3, -14], dtype=np.int8)
274285 * bitwise_ops.right_shift(lhs, rhs)
275- * # <tf.Tensor: shape=(4,), dtype=int8, numpy=array([ -2, 64, 101, 32],
276- * dtype=int8)>
286+ * # <tf.Tensor: shape=(4,), dtype=int8, numpy=array([ -2, 64, 101, 32], dtype=int8)>
277287 *
288+ * ```
278289 *
279- * @param T data type for ` z` output
290+ * @param <T> data type for `z` output
280291 * @param x the x value
281292 * @param y the y value
282- * @param T data type for ` RightShift` output and operands
293+ * @param <T> data type for `RightShift` output and operands
283294 * @return a new instance of RightShift
284295 * @see org.tensorflow.op.BitwiseOps.rightShift
285296 */
0 commit comments