Reputation: 74
What is the difference between the depthwise_conv2d and depthwise_conv2d_native in TensorFlow ?
Upvotes: 1
Views: 626
Reputation: 656
As noted in the following unit test, https://github.com/tensorflow/tensorflow/blob/b0ecc7d2c1486367ec65d297e372f8935ee3ddfe/tensorflow/python/kernel_tests/depthwise_conv_op_test.py#L87
.. they are indeed supposed to be identical (when no stride is present). depthwise_conv2d_native
is the simpler implementation that doesn't have strides, and goes straight to a C++/CUDA operation. depthwise_conv2d
takes an optional stride
argument; it passes this into with_space_as_batch
to do the stride, and then that calls depthwise_conv2d_native
as the backend.
So, bottom line: there isn't a different in what they compute. In terms of performance, depthwise_conv2d
could add marrrrrrginally more complexity to your model, but adds the flexibility that you can have variable strides.
Upvotes: 2