Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Add convenience fluent method for squeeze op #9734

Merged
merged 2 commits into from
Feb 9, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions python/mxnet/ndarray/ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1545,6 +1545,14 @@ def log_softmax(self, *args, **kwargs):
"""
return op.log_softmax(self, *args, **kwargs)

def squeeze(self, *args, **kwargs):
"""Convenience fluent method for :py:func:`squeeze`.
The arguments are the same as for :py:func:`squeeze`, with
this array as data.
"""
return op.squeeze(self, *args, **kwargs)

# pylint: disable= undefined-variable
def broadcast_to(self, shape):
"""Broadcasts the input array to a new shape.
Expand Down
8 changes: 8 additions & 0 deletions python/mxnet/symbol/symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -2356,6 +2356,14 @@ def log_softmax(self, *args, **kwargs):
"""
return op.log_softmax(self, *args, **kwargs)

def squeeze(self, *args, **kwargs):
"""Convenience fluent method for :py:func:`squeeze`.
The arguments are the same as for :py:func:`squeeze`, with
this array as data.
"""
return op.squeeze(self, *args, **kwargs)

def wait_to_read(self):
raise NotImplementedForSymbol(self.wait_to_read, None)

Expand Down