Fix bug in reduce_join's handling of arg keepdims
(in TF 1.x).
PiperOrigin-RevId: 259017062
This commit is contained in:
parent
84d5ed5ba6
commit
0d1de81afe
@ -351,6 +351,16 @@ class ReduceJoinTest(UnicodeTestCase):
|
|||||||
with self.assertRaisesOpError("reduction dimension 2"):
|
with self.assertRaisesOpError("reduction dimension 2"):
|
||||||
reduced.eval(feed_dict={placeholder.name: 2})
|
reduced.eval(feed_dict={placeholder.name: 2})
|
||||||
|
|
||||||
|
def testDeprecatedArgs(self):
|
||||||
|
foobar = constant_op.constant(["foobar"])
|
||||||
|
# Old names: keep_dims and reduction_indices
|
||||||
|
output = string_ops.reduce_join(
|
||||||
|
["foo", "bar"], reduction_indices=0, keep_dims=True)
|
||||||
|
self.assertAllEqual(foobar, output)
|
||||||
|
# New names keepdims and axis.
|
||||||
|
output = string_ops.reduce_join(["foo", "bar"], axis=0, keepdims=True)
|
||||||
|
self.assertAllEqual(foobar, output)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test.main()
|
test.main()
|
||||||
|
@ -326,13 +326,15 @@ def _reduce_join_reduction_dims(x, axis, reduction_indices):
|
|||||||
@tf_export(v1=["strings.reduce_join", "reduce_join"])
|
@tf_export(v1=["strings.reduce_join", "reduce_join"])
|
||||||
@deprecation.deprecated_endpoints("reduce_join")
|
@deprecation.deprecated_endpoints("reduce_join")
|
||||||
def reduce_join(inputs, axis=None, # pylint: disable=missing-docstring
|
def reduce_join(inputs, axis=None, # pylint: disable=missing-docstring
|
||||||
keep_dims=False,
|
keep_dims=None,
|
||||||
separator="",
|
separator="",
|
||||||
name=None,
|
name=None,
|
||||||
reduction_indices=None,
|
reduction_indices=None,
|
||||||
keepdims=None):
|
keepdims=None):
|
||||||
keep_dims = deprecation.deprecated_argument_lookup(
|
keep_dims = deprecation.deprecated_argument_lookup(
|
||||||
"keepdims", keepdims, "keep_dims", keep_dims)
|
"keepdims", keepdims, "keep_dims", keep_dims)
|
||||||
|
if keep_dims is None:
|
||||||
|
keep_dims = False
|
||||||
inputs_t = ops.convert_to_tensor(inputs)
|
inputs_t = ops.convert_to_tensor(inputs)
|
||||||
reduction_indices = _reduce_join_reduction_dims(
|
reduction_indices = _reduce_join_reduction_dims(
|
||||||
inputs_t, axis, reduction_indices)
|
inputs_t, axis, reduction_indices)
|
||||||
|
@ -1874,7 +1874,7 @@ tf_module {
|
|||||||
}
|
}
|
||||||
member_method {
|
member_method {
|
||||||
name: "reduce_join"
|
name: "reduce_join"
|
||||||
argspec: "args=[\'inputs\', \'axis\', \'keep_dims\', \'separator\', \'name\', \'reduction_indices\', \'keepdims\'], varargs=None, keywords=None, defaults=[\'None\', \'False\', \'\', \'None\', \'None\', \'None\'], "
|
argspec: "args=[\'inputs\', \'axis\', \'keep_dims\', \'separator\', \'name\', \'reduction_indices\', \'keepdims\'], varargs=None, keywords=None, defaults=[\'None\', \'None\', \'\', \'None\', \'None\', \'None\'], "
|
||||||
}
|
}
|
||||||
member_method {
|
member_method {
|
||||||
name: "reduce_logsumexp"
|
name: "reduce_logsumexp"
|
||||||
|
@ -26,7 +26,7 @@ tf_module {
|
|||||||
}
|
}
|
||||||
member_method {
|
member_method {
|
||||||
name: "reduce_join"
|
name: "reduce_join"
|
||||||
argspec: "args=[\'inputs\', \'axis\', \'keep_dims\', \'separator\', \'name\', \'reduction_indices\', \'keepdims\'], varargs=None, keywords=None, defaults=[\'None\', \'False\', \'\', \'None\', \'None\', \'None\'], "
|
argspec: "args=[\'inputs\', \'axis\', \'keep_dims\', \'separator\', \'name\', \'reduction_indices\', \'keepdims\'], varargs=None, keywords=None, defaults=[\'None\', \'None\', \'\', \'None\', \'None\', \'None\'], "
|
||||||
}
|
}
|
||||||
member_method {
|
member_method {
|
||||||
name: "regex_full_match"
|
name: "regex_full_match"
|
||||||
|
Loading…
Reference in New Issue
Block a user