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

[RELAY]sch and compute for reduce ops #2091

Merged
merged 2 commits into from
Nov 26, 2018

Conversation

siju-samuel
Copy link
Member

@siju-samuel siju-samuel commented Nov 13, 2018

#2051
Thanks for contributing to TVM! Please refer to guideline https://docs.tvm.ai/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from Reviewers.

@jroesch
Copy link
Member

jroesch commented Nov 13, 2018

Looks good to me once CI passes.

@siju-samuel siju-samuel force-pushed the relay_reduce_comp_sch branch 2 times, most recently from 3822b2a to 775fdb0 Compare November 13, 2018 11:26
@siju-samuel
Copy link
Member Author

======================================================================
ERROR: test_top_level4.test_reduce
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/workspace/nnvm/tests/python/compiler/test_top_level4.py", line 98, in test_reduce
    verify_reduce((4, 4, 3), np.sum, sym.sum)
  File "/workspace/nnvm/tests/python/compiler/test_top_level4.py", line 56, in verify_reduce
    verify_reduce_explicit(dshape, data, result, fsym, oshape=oshape, otype=otype, **kwargs)
  File "/workspace/nnvm/tests/python/compiler/test_top_level4.py", line 37, in verify_reduce_explicit
    graph, lib, _ = nnvm.compiler.build(y, target, {"x": dshape})
  File "/workspace/nnvm/python/nnvm/compiler/build_module.py", line 305, in build
    graph = graph.apply("GraphCompile")
  File "/workspace/nnvm/python/nnvm/graph.py", line 234, in apply
    check_call(_LIB.NNGraphApplyPasses(self.handle, npass, cpass, ctypes.byref(ghandle)))
  File "/workspace/nnvm/python/nnvm/_base.py", line 75, in check_call
    raise NNVMError(py_str(_LIB.NNGetLastError()))
NNVMError: [12:10:58] /workspace/nnvm/src/compiler/compile_engine.cc:212: Check failed: out[i].ndim() == out_info[i].ndim() (0 vs. 1) sum

Any idea why nnvm/tests/python/compiler/test_top_level4.py script is failing in CI?

@siju-samuel siju-samuel force-pushed the relay_reduce_comp_sch branch 5 times, most recently from 7b96479 to 9775d5d Compare November 20, 2018 04:24
@siju-samuel siju-samuel reopened this Nov 20, 2018
@siju-samuel siju-samuel changed the title [RELAY]sch and compute for reduce ops [wip][RELAY]sch and compute for reduce ops Nov 20, 2018
@siju-samuel siju-samuel force-pushed the relay_reduce_comp_sch branch 2 times, most recently from fd7f81f to e178285 Compare November 20, 2018 09:26
@siju-samuel siju-samuel force-pushed the relay_reduce_comp_sch branch 2 times, most recently from 9d8b87c to 204fc60 Compare November 22, 2018 03:59
@siju-samuel siju-samuel changed the title [wip][RELAY]sch and compute for reduce ops [RELAY]sch and compute for reduce ops Nov 22, 2018
const Target& target) {
const auto* param = attrs.as<ReduceAttrs>();
auto r_axes = GetReduceAxes(inputs[0]->shape.size(),
param->axis, param->exclude);
Copy link
Member

Choose a reason for hiding this comment

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

This is certainly the shortest line of addition to implement the feature. But not necessarily the fastest to run. Note that the reduction in topi already supports negative index. So we don't need to handle negative index here, the only thing we need to handle is exclude, we can use another function GetExcludeAxes to get the other axes and return them as Array when there is exclude


def _schedule_reduce(_, outs, target):
"""Generic schedule for reduce"""
with tvm.target.create(target):
Copy link
Member

Choose a reason for hiding this comment

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

with target:

@tqchen
Copy link
Member

tqchen commented Nov 25, 2018

see the compute impl in #2163 that reflects the commend, the test-cases are still helpful and we would like to bring it in after 2163

@tqchen tqchen merged commit b5e0d79 into apache:master Nov 26, 2018
@tqchen
Copy link
Member

tqchen commented Nov 26, 2018

Thanks @siju-samuel @jroesch this is merged

@siju-samuel siju-samuel deleted the relay_reduce_comp_sch branch November 27, 2018 06:42
FrozenGene pushed a commit to FrozenGene/tvm that referenced this pull request Dec 27, 2018
wweic pushed a commit to neo-ai/tvm that referenced this pull request Feb 20, 2019
wweic pushed a commit to neo-ai/tvm that referenced this pull request Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants