Wraps the XLA ConvGeneralDilated operator. ConvGeneralDilated is the most general form of XLA convolution and is documented at https://www.tensorflow.org/performance/xla/operation_semantics#conv_convolution Args: lhs: the input tensor rhs: the kernel tensor window_strides: the
(lhs,
rhs,
window_strides,
padding,
lhs_dilation,
rhs_dilation,
dimension_numbers,
feature_group_count=1,
precision_config=None,
name=None)
| 226 | |
| 227 | |
| 228 | def conv(lhs, |
| 229 | rhs, |
| 230 | window_strides, |
| 231 | padding, |
| 232 | lhs_dilation, |
| 233 | rhs_dilation, |
| 234 | dimension_numbers, |
| 235 | feature_group_count=1, |
| 236 | precision_config=None, |
| 237 | name=None): |
| 238 | """Wraps the XLA ConvGeneralDilated operator. |
| 239 | |
| 240 | ConvGeneralDilated is the most general form of XLA convolution and is |
| 241 | documented at |
| 242 | https://www.tensorflow.org/performance/xla/operation_semantics#conv_convolution |
| 243 | |
| 244 | Args: |
| 245 | lhs: the input tensor |
| 246 | rhs: the kernel tensor |
| 247 | window_strides: the inter-window strides |
| 248 | padding: the padding to apply at the start and end of each input dimensions |
| 249 | lhs_dilation: dilation to apply between input elements |
| 250 | rhs_dilation: dilation to apply between kernel elements |
| 251 | dimension_numbers: a `ConvolutionDimensionNumbers` proto. |
| 252 | feature_group_count: number of feature groups for grouped convolution. |
| 253 | precision_config: a `xla.PrecisionConfig` proto. |
| 254 | name: an optional name for the operator |
| 255 | |
| 256 | Returns: |
| 257 | A tensor representing the output of the convolution. |
| 258 | """ |
| 259 | precision_config_proto = "" |
| 260 | if precision_config: |
| 261 | precision_config_proto = precision_config.SerializeToString() |
| 262 | return gen_xla_ops.xla_conv( |
| 263 | lhs, |
| 264 | rhs, |
| 265 | window_strides=window_strides, |
| 266 | padding=padding, |
| 267 | lhs_dilation=lhs_dilation, |
| 268 | rhs_dilation=rhs_dilation, |
| 269 | feature_group_count=feature_group_count, |
| 270 | dimension_numbers=dimension_numbers.SerializeToString(), |
| 271 | precision_config=precision_config_proto, |
| 272 | name=name) |
| 273 | |
| 274 | |
| 275 | convert_element_type = math_ops.cast |