-
Notifications
You must be signed in to change notification settings - Fork 0
Adds separable convolution block #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
FloopCZ
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @bedapisl for adding this directly to blocks, I sincerely hope this will help us with the network speed on ARM.
| raise ValueError('SeparableConvBlock only supports inputs with rank 4 \ | ||
| (i.e. batch_size, height, width, channels)') | ||
|
|
||
| x = slim.separable_conv2d(x, num_outputs=self._channels, kernel_size=(self._kernel, self._kernel), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I have to admit that I would prefer tf.layers in new code, but the variable scopes would not work. :-/)
https://www.tensorflow.org/api_docs/python/tf/layers/separable_conv2d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an issue for it... (#9)
| **kwargs) | ||
|
|
||
| def _handle_parsed_args(self, channels: str, kernel: str, | ||
| __, stride: Union[str, int]) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double underscore.
| **code**: ``(num_filters)sep(kernel_size)[s(stride)]`` | ||
| **examples**: ``64sep3``, ``64sep3s2``, ``64sep3-5s2`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does 64sep3-5s2 actually work? 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, my fault.
| self._channels, self._kernel, self._stride = int(channels), int(kernel), int(stride) | ||
|
|
||
| def apply(self, x: tf.Tensor) -> tf.Tensor: | ||
| if len(self._extra_dim) >= 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not check the length of the shape of x directly?
|
|
||
| def inverse_code(self) -> str: | ||
| if self._stride > 1: | ||
| raise ValueError('Inverse code for conv block is not defined for stride `{}`'.format(self._stride)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
separable conv block
| raise ValueError('SeparableConvBlock only supports inputs with rank 4 \ | ||
| (i.e. batch_size, height, width, channels)') | ||
|
|
||
| x = slim.separable_conv2d(x, num_outputs=self._channels, kernel_size=(self._kernel, self._kernel), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an issue for it... (#9)
No description provided.