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

enable hidden arg #3939

Merged
merged 1 commit into from
Nov 24, 2016
Merged

enable hidden arg #3939

merged 1 commit into from
Nov 24, 2016

Conversation

piiswrong
Copy link
Contributor

refactor lr_mult, wd_mult, ctx_group

revert test

update submodule

@piiswrong
Copy link
Contributor Author

@tqchen

const char **keys,
const char **vals,
SymbolHandle *out);
int MXSymbolSetAttrs(SymbolHandle symbol,
Copy link
Member

Choose a reason for hiding this comment

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

seems no changes in here?

Copy link
Member

Choose a reason for hiding this comment

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

oh i see it now

@tqchen
Copy link
Member

tqchen commented Nov 22, 2016

Need to enable attributes in https://github.com/dmlc/mxnet-memonger for backing memory monger

@piiswrong
Copy link
Contributor Author

piiswrong commented Nov 22, 2016

Refactor it and merge into mxnet?

@tqchen
Copy link
Member

tqchen commented Nov 22, 2016

to make sure things won;t break, can you push a PR to https://github.com/dmlc/mxnet-memonger to change the attribute force_mirroring to __force_mirror__?

@piiswrong
Copy link
Contributor Author

only julia failed. please review again and merge

std::unordered_map<std::string, std::string> kwargs;
for (nn_uint i = 0; i < num_param; ++i) {
bool flag = false;
for (const auto &k : kHiddenKeys) {
Copy link
Member

Choose a reason for hiding this comment

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

I am a bit worried about this procedure. Direct checking things in here can make things slow. We will need a speed test under cython mode to confirm this do not affect the symbol composition speed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you have scripts for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's only a loop over 3 elements, so hopefully won't be a big deal

Copy link
Member

Choose a reason for hiding this comment

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

Can you use something like a global map structure? so it is O(1)?

Copy link
Member

Choose a reason for hiding this comment

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

I am fine merging it if it will get eventually deleted after evolution.

For speed testing, simply do elementwise add composition and measure ops /sec

@tqchen
Copy link
Member

tqchen commented Nov 23, 2016

See my comment about potential speed issues.

@piiswrong
Copy link
Contributor Author

@tqchen jxie@jxie-gpu:/scratch/mxnet$ MXNET_ENFORCE_CYTHON=1 python -m timeit -s "import mxnet as mx; a = mx.sym.Variable('A'); b = mx.sym.Variable('B')" "c = 10*a + 5/b"
10000 loops, best of 3: 22.1 usec per loop

refactor lr_mult, wd_mult, ctx_group

revert test

update submodule

fix
@tqchen
Copy link
Member

tqchen commented Nov 24, 2016

a historical way is to do something like

import mxnet as mx
import time

a = mx.sym.Variable('a')
b = mx.sym.Variable('b')
start = time.time()
nrep = 100
nstep = 10000
for i in range(nrep):
    for j in range(nstep):
       a = a + b
end = time.time()
print("%g ops/sec" % nrep* nstep/(end-start))
```

@tqchen
Copy link
Member

tqchen commented Nov 24, 2016

Need to measure the speed under cython build, both before and after the change

@piiswrong
Copy link
Contributor Author

piiswrong commented Nov 24, 2016

before the change:
jxie@jxie-gpu:/scratch/mxnet$ MXNET_ENFORCE_CYTHON=1 python -m timeit -s "import mxnet as mx; a = mx.sym.Variable('A'); b = mx.sym.Variable('B')" "c = 10*a + 5/b"
10000 loops, best of 3: 20.2 usec per loop

so the difference is 10%. Doesn't seem to matter much

@tqchen
Copy link
Member

tqchen commented Nov 24, 2016

will the set of kHiddenArgs grow later, or is it only for deprecation warning purposes? If it is, we can make sure they get removed in next major version

@piiswrong
Copy link
Contributor Author

its the difference between typing Activation(lr_mult=xx) or Activation(lr_mult=xx)

@tqchen
Copy link
Member

tqchen commented Nov 24, 2016

I see, I am fine with merging it if you can run a python test script I posted. I hope we do not do such automatic conversion in the backend for more arguments, but instead ask user to directly write underscore for front-end attributes(or have some function so help doing so)

@piiswrong
Copy link
Contributor Author

84245.5 ops/sec

@piiswrong piiswrong merged commit 961f039 into apache:nnvm Nov 24, 2016
piiswrong added a commit that referenced this pull request Nov 30, 2016
refactor lr_mult, wd_mult, ctx_group

revert test

update submodule

fix
yajiedesign pushed a commit to yajiedesign/mxnet that referenced this pull request Nov 30, 2016
refactor lr_mult, wd_mult, ctx_group

revert test

update submodule

fix
piiswrong added a commit that referenced this pull request Dec 11, 2016
refactor lr_mult, wd_mult, ctx_group

revert test

update submodule

fix
piiswrong added a commit to piiswrong/mxnet that referenced this pull request Dec 24, 2016
refactor lr_mult, wd_mult, ctx_group

revert test

update submodule

fix
piiswrong added a commit to piiswrong/mxnet that referenced this pull request Dec 29, 2016
refactor lr_mult, wd_mult, ctx_group

revert test

update submodule

fix
piiswrong added a commit to piiswrong/mxnet that referenced this pull request Dec 29, 2016
refactor lr_mult, wd_mult, ctx_group

revert test

update submodule

fix
piiswrong added a commit that referenced this pull request Dec 29, 2016
refactor lr_mult, wd_mult, ctx_group

revert test

update submodule

fix
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants