Move name
argument to the end of the shape
, size
, and sparse.concat
functions.
Add a rewrite rule for `sparse_concat` to `sparse.concat`. PiperOrigin-RevId: 221662719
This commit is contained in:
parent
87ca7af692
commit
79e73ee229
tensorflow
python/ops
tools
@ -269,7 +269,13 @@ def broadcast_static_shape(shape_x, shape_y):
|
||||
return common_shapes.broadcast_shape(shape_x, shape_y)
|
||||
|
||||
|
||||
@tf_export("shape")
|
||||
@tf_export("shape", v1=[])
|
||||
def shape_v2(input, out_type=dtypes.int32, name=None):
|
||||
# pylint: disable=redefined-builtin
|
||||
return shape(input, name, out_type)
|
||||
|
||||
|
||||
@tf_export(v1=["shape"])
|
||||
def shape(input, name=None, out_type=dtypes.int32):
|
||||
# pylint: disable=redefined-builtin
|
||||
"""Returns the shape of a tensor.
|
||||
@ -342,7 +348,13 @@ def shape_n(input, out_type=dtypes.int32, name=None):
|
||||
return gen_array_ops.shape_n(input, out_type=out_type, name=name)
|
||||
|
||||
|
||||
@tf_export("size")
|
||||
@tf_export("size", v1=[])
|
||||
def size_v2(input, out_type=dtypes.int32, name=None):
|
||||
# pylint: disable=redefined-builtin
|
||||
return size(input, name, out_type)
|
||||
|
||||
|
||||
@tf_export(v1=["size"])
|
||||
def size(input, name=None, out_type=dtypes.int32):
|
||||
# pylint: disable=redefined-builtin
|
||||
"""Returns the size of a tensor.
|
||||
|
@ -185,8 +185,14 @@ def sparse_eye(num_rows,
|
||||
dense_shape=[num_rows, num_columns])
|
||||
|
||||
|
||||
@tf_export("sparse.concat", "sparse_concat", v1=[])
|
||||
def sparse_concat_v2(axis, sp_inputs, expand_nonconcat_dim=False,
|
||||
concat_dim=None, name=None):
|
||||
return sparse_concat(axis, sp_inputs, name, expand_nonconcat_dim, concat_dim)
|
||||
|
||||
|
||||
# pylint: disable=protected-access
|
||||
@tf_export("sparse.concat", "sparse_concat")
|
||||
@tf_export(v1=["sparse.concat", "sparse_concat"])
|
||||
@deprecation.deprecated_endpoints("sparse_concat")
|
||||
@deprecation.deprecated_args(
|
||||
None, "concat_dim is deprecated, use axis instead", "concat_dim")
|
||||
|
@ -1058,7 +1058,7 @@ tf_module {
|
||||
}
|
||||
member_method {
|
||||
name: "shape"
|
||||
argspec: "args=[\'input\', \'name\', \'out_type\'], varargs=None, keywords=None, defaults=[\'None\', \"<dtype: \'int32\'>\"], "
|
||||
argspec: "args=[\'input\', \'out_type\', \'name\'], varargs=None, keywords=None, defaults=[\"<dtype: \'int32\'>\", \'None\'], "
|
||||
}
|
||||
member_method {
|
||||
name: "shape_n"
|
||||
@ -1082,7 +1082,7 @@ tf_module {
|
||||
}
|
||||
member_method {
|
||||
name: "size"
|
||||
argspec: "args=[\'input\', \'name\', \'out_type\'], varargs=None, keywords=None, defaults=[\'None\', \"<dtype: \'int32\'>\"], "
|
||||
argspec: "args=[\'input\', \'out_type\', \'name\'], varargs=None, keywords=None, defaults=[\"<dtype: \'int32\'>\", \'None\'], "
|
||||
}
|
||||
member_method {
|
||||
name: "slice"
|
||||
@ -1094,7 +1094,7 @@ tf_module {
|
||||
}
|
||||
member_method {
|
||||
name: "sparse_concat"
|
||||
argspec: "args=[\'axis\', \'sp_inputs\', \'name\', \'expand_nonconcat_dim\', \'concat_dim\'], varargs=None, keywords=None, defaults=[\'None\', \'False\', \'None\'], "
|
||||
argspec: "args=[\'axis\', \'sp_inputs\', \'expand_nonconcat_dim\', \'concat_dim\', \'name\'], varargs=None, keywords=None, defaults=[\'False\', \'None\', \'None\'], "
|
||||
}
|
||||
member_method {
|
||||
name: "sparse_to_dense"
|
||||
|
@ -14,7 +14,7 @@ tf_module {
|
||||
}
|
||||
member_method {
|
||||
name: "concat"
|
||||
argspec: "args=[\'axis\', \'sp_inputs\', \'name\', \'expand_nonconcat_dim\', \'concat_dim\'], varargs=None, keywords=None, defaults=[\'None\', \'False\', \'None\'], "
|
||||
argspec: "args=[\'axis\', \'sp_inputs\', \'expand_nonconcat_dim\', \'concat_dim\', \'name\'], varargs=None, keywords=None, defaults=[\'False\', \'None\', \'None\'], "
|
||||
}
|
||||
member_method {
|
||||
name: "cross"
|
||||
|
@ -58,6 +58,7 @@ class TFAPIChangeSpec(ast_edits.APIChangeSpec):
|
||||
# pylint: disable=line-too-long
|
||||
# Add additional renames not in renames_v2.py here.
|
||||
self.symbol_renames.update({
|
||||
"tf.sparse_concat": "tf.sparse.concat",
|
||||
})
|
||||
# pylint: enable=line-too-long
|
||||
|
||||
@ -75,11 +76,10 @@ class TFAPIChangeSpec(ast_edits.APIChangeSpec):
|
||||
# IMPORTANT: order here should correspond to OLD argument order.
|
||||
# We just prepend "arg_name=" to all arguments in function calls.
|
||||
self.function_reorders = {
|
||||
"tf.argmax": ["input", "axis", "output_type", "name"],
|
||||
"tf.argmin": ["input", "axis", "output_type", "name"],
|
||||
"tf.argmax": ["input", "axis", "name", "dimension", "output_type"],
|
||||
"tf.argmin": ["input", "axis", "name", "dimension", "output_type"],
|
||||
"tf.boolean_mask": ["tensor", "mask", "name", "axis"],
|
||||
"tf.convert_to_tensor": ["value", "dtype", "preferred_dtype", "name"],
|
||||
"tf.pad": ["tensor", "paddings", "mode", "name", "constant_values"],
|
||||
"tf.convert_to_tensor": ["value", "dtype", "name", "preferred_dtype"],
|
||||
"tf.nn.pool": [
|
||||
"input", "window_shape", "pooling_type", "padding", "dilation_rate",
|
||||
"strides", "name", "data_format"
|
||||
@ -88,6 +88,12 @@ class TFAPIChangeSpec(ast_edits.APIChangeSpec):
|
||||
"input", "depthwise_filter", "pointwise_filter", "strides",
|
||||
"padding", "data_format", "dilations", "name"
|
||||
],
|
||||
"tf.pad": ["tensor", "paddings", "mode", "name", "constant_values"],
|
||||
"tf.shape": ["input", "name", "out_type"],
|
||||
"tf.size": ["input", "name", "out_type"],
|
||||
"tf.sparse.concat": [
|
||||
"axis", "sp_inputs", "name", "expand_nonconcat_dim", "concat_dim"
|
||||
],
|
||||
}
|
||||
|
||||
# Specially handled functions.
|
||||
|
Loading…
Reference in New Issue
Block a user