Skip to content
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

[TOPI] Add ops compute #323

Merged
merged 3 commits into from
Aug 15, 2017
Merged

[TOPI] Add ops compute #323

merged 3 commits into from
Aug 15, 2017

Conversation

ZihengJiang
Copy link
Contributor

No description provided.

@tqchen
Copy link
Member

tqchen commented Aug 14, 2017

Most declaration function are supposed to be used directly used by the user, following same convention as numpy and mxnet/pytorch/tf style. Remove compute prefix from them

@ZihengJiang ZihengJiang reopened this Aug 14, 2017
import tvm

@tvm.tag_scope(tag='softmax')
def softmax_output(x):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename as softmax

assert len(x.shape) == 2, "only support 2-dim softmax"
M, N = x.shape
k = tvm.reduce_axis((0, N), name='k')
expsum = tvm.compute((M, ), lambda i: \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This softmax is not numerically stable. To make things numerically stable, need to substract the maximum value along the columns first


Returns
-------
output : tvm.Tensor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be three output arguments, according to what get returned

dheight = tvm.reduce_axis((0, kernel_height))
dwidth = tvm.reduce_axis((0, kernel_width))

temp = tvm.compute((batch, channel, padded_height, padded_width), lambda i, c, h, w: \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed with @Huyuwei we should add a explicit pad operator along with dilate, and call that from pooling and conv

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #316 for reference of supporting padding arbitrary dimension tensors

Remove 'compute' and add assert for safety

Add document

fix lint

fix softmax
@ZihengJiang ZihengJiang changed the title [WIP] [TOPI] Add ops compute [TOPI] Add ops compute Aug 15, 2017
@tqchen tqchen merged commit 0ad590c into apache:master Aug 15, 2017
@ZihengJiang ZihengJiang deleted the topi branch August 15, 2017 06:40
tqchen pushed a commit to tqchen/tvm that referenced this pull request May 26, 2018
…he#323)

* Explain how to generate module library

* Small fix
tqchen pushed a commit that referenced this pull request May 29, 2018
* Explain how to generate module library

* Small fix
tqchen pushed a commit to tqchen/tvm that referenced this pull request Jul 6, 2018
…he#323)

* Explain how to generate module library

* Small fix
sergei-mironov pushed a commit to sergei-mironov/tvm that referenced this pull request Aug 8, 2018
…he#323)

* Explain how to generate module library

* Small fix
vinx13 pushed a commit to vinx13/tvm that referenced this pull request Mar 9, 2022
gigiblender pushed a commit to gigiblender/tvm that referenced this pull request Jan 19, 2023
* Introduce match cast, and code changes along

* add match_cast parser support (apache#9)

* Match cast support for VMShapeLower CanonicalizeBinding

* Remove `match_shape` (apache#12)

* Refactor ExprVisitor/Mutator to consider Expr in StructInfo.

Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
junrushao pushed a commit to junrushao/tvm that referenced this pull request Feb 8, 2023
* Introduce match cast, and code changes along

* add match_cast parser support (#9)

* Match cast support for VMShapeLower CanonicalizeBinding

* Remove `match_shape` (#12)

* Refactor ExprVisitor/Mutator to consider Expr in StructInfo.

Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
yelite pushed a commit to yelite/tvm that referenced this pull request Feb 17, 2023
* Introduce match cast, and code changes along

* add match_cast parser support (#9)

* Match cast support for VMShapeLower CanonicalizeBinding

* Remove `match_shape` (#12)

* Refactor ExprVisitor/Mutator to consider Expr in StructInfo.

Co-authored-by: Siyuan Feng <Hzfengsy@sjtu.edu.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants