--- Log opened Tue Jan 22 00:00:38 2019 | ||
-!- saurabh7 [~saurabh7@106.51.18.183] has quit [Remote host closed the connection] | 04:36 | |
-!- saurabh7 [~saurabh7@111.93.133.226] has joined #shogun | 06:37 | |
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun | 10:27 | |
-!- mode/#shogun [+o wiking] by ChanServ | 10:27 | |
-!- witness [uid10044@gateway/web/irccloud.com/x-olpljxnlfdxrhnfd] has joined #shogun | 10:44 | |
-!- saurabh7 [~saurabh7@111.93.133.226] has quit [] | 11:09 | |
-!- wiking [~wiking@huwico/staff/wiking] has quit [Remote host closed the connection] | 11:21 | |
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun | 11:26 | |
-!- mode/#shogun [+o wiking] by ChanServ | 11:26 | |
-!- Lefteris [836fb90d@gateway/web/freenode/ip.131.111.185.13] has joined #shogun | 11:39 | |
-!- wiking [~wiking@huwico/staff/wiking] has quit [Remote host closed the connection] | 12:47 | |
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun | 13:01 | |
-!- mode/#shogun [+o wiking] by ChanServ | 13:01 | |
-shogun-buildbot:#shogun- Build deb3 - interfaces #395 is complete: Success [build successful] - http://buildbot.shogun-toolbox.org:8080/#builders/37/builds/395 | 13:06 | |
-!- gf712 [8028b333@gateway/web/freenode/ip.128.40.179.51] has joined #shogun | 14:08 | |
@wiking | gf712: y0 | 14:24 |
---|---|---|
gf712 | hey! | 14:24 |
gf712 | just saw your comment on github. Why do we need parameter_names in libshogun? | 14:25 |
@wiking | why not? :) | 14:27 |
gf712 | I was thinking that you probably wouldn't use it because it's more of scripting language thing no? | 14:27 |
@wiking | mmm not so sure... i mean it'd be good to be able to iterate through the params of a model | 14:28 |
gf712 | OK, I just removed it because no one was using it other than in a test | 14:30 |
gf712 | so I thought there was a better way to access that information | 14:30 |
gf712 | from inside the library | 14:30 |
-!- witness [uid10044@gateway/web/irccloud.com/x-olpljxnlfdxrhnfd] has quit [Quit: Connection closed for inactivity] | 14:34 | |
-!- wiking [~wiking@huwico/staff/wiking] has quit [Remote host closed the connection] | 14:40 | |
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun | 14:46 | |
-!- mode/#shogun [+o wiking] by ChanServ | 14:46 | |
@wiking | gf712: how? :) | 14:46 |
@wiking | gf712: sorry i've got disconnected and this was your last msg | 14:48 |
@wiking | "from inside the library " | 14:48 |
gf712 | yup, that was my last message | 14:51 |
gf712 | I am thinking how else you can get it :D | 14:51 |
@wiking | :> | 14:52 |
@wiking | ok | 14:52 |
gf712 | btw std::reference_wrapper<const AnyParameter> doesn't do what I thought | 14:53 |
gf712 | I can easily change the values of the map | 14:53 |
gf712 | so I am thinking if I shouldn't return a copy in get_parameters? | 14:53 |
@wiking | mmmm | 14:57 |
@wiking | good q | 14:57 |
gf712 | yea.. right now doing something like this `AnyParameter anyparam = each->second.get(); anyparam = a;` is enough to change the self->map | 15:02 |
gf712 | Which is what I wanted to avoid with the const... | 15:03 |
@wiking | mmm | 15:05 |
gf712 | you can of course do this `const auto anyparam = each->second.get();`, but it's east to forget that const... | 15:10 |
@wiking | mmm yeah | 15:10 |
@wiking | i mean the return value of that map should be const values | 15:11 |
@wiking | as we dont want to enable changing | 15:11 |
@wiking | so probably best is to 'copy' | 15:11 |
@wiking | but i mean when u have | 15:11 |
@wiking | std::reference_wrapper<const AnyParameter> and do a get on that | 15:12 |
@wiking | you get a const anyparam no? | 15:12 |
gf712 | No, that's what I thought | 15:12 |
@wiking | mmmmm | 15:13 |
@wiking | that is weird | 15:13 |
@wiking | i mean it hsould return T& | 15:13 |
@wiking | where T = const AnyParam | 15:13 |
gf712 | but get is defined like this in the standard T& get() const noexcept { return *_ptr; } | 15:13 |
@wiking | ok but T is = const AnyParameter | 15:13 |
@wiking | no? | 15:13 |
gf712 | ahh wait | 15:14 |
@wiking | so when u do | 15:14 |
gf712 | i use std::cref | 15:14 |
gf712 | on const AnyParameter | 15:14 |
gf712 | which evaluates then T = AnyParameter? | 15:14 |
gf712 | or isn't that how it works? | 15:15 |
gf712 | basically should use std:ref instead when building the map? | 15:15 |
@wiking | i mean based on specs | 15:16 |
@wiking | std::cref<T>(const T& t) = std::reference_wrapper<const T>(t) | 15:16 |
@wiking | so based on this it does what you just described... i mean it returns a std::reference_wrapper<const T> | 15:17 |
@wiking | i'm wondering where does the const gets dropped | 15:17 |
@wiking | lemme test this in a simple code :) | 15:17 |
gf712 | ok, if I use std::ref I get T = const shogun::AnyParameter | 15:18 |
gf712 | so when I modify it I get a compiler error | 15:18 |
gf712 | i'm using gcc 7 btw | 15:18 |
gf712 | I just thought std::cref would make T const no matter what, should have read the spec better! | 15:21 |
@wiking | ok | 15:26 |
@wiking | gf712: i've just created a simple test | 15:26 |
@wiking | doesn't look good :D | 15:26 |
@wiking | but there's somewhere a copy ctor :) | 15:27 |
gf712 | what do you mean? what return type do you get for get? | 15:27 |
gf712 | what do you test for? | 15:27 |
@wiking | gf712: https://pastebin.com/xA18XRHr | 15:29 |
@wiking | this you would expect not to work/or have at leat the same values no ? :) | 15:29 |
@wiking | *least | 15:29 |
@wiking | 11 10 | 15:29 |
@wiking | is the output | 15:29 |
@wiking | :)))) | 15:29 |
@wiking | so wtf | 15:30 |
@wiking | :) | 15:30 |
-!- shubham808 [~atom@14.139.240.247] has joined #shogun | 15:31 | |
gf712 | oh, but you are changing it with a method | 15:31 |
gf712 | but I would expect it to print 11 11 | 15:31 |
@wiking | yeah at least that | 15:31 |
@wiking | but no | 15:32 |
@wiking | :) | 15:32 |
@wiking | but i was expecting | 15:32 |
@wiking | that if it returns | 15:32 |
@wiking | CONST A | 15:32 |
@wiking | then .set will fail | 15:32 |
@wiking | on compile time | 15:32 |
gf712 | why would it fail at compile time? | 15:32 |
@wiking | because you call a non const method | 15:32 |
@wiking | on a const object | 15:32 |
gf712 | the compiler doesn't know that set changes it | 15:32 |
@wiking | it's a non-const method | 15:32 |
gf712 | oh right | 15:33 |
@wiking | ./test.cpp:32:4: error: 'this' argument to member function 'set' has type 'const A', but function is not marked const | 15:33 |
@wiking | b.set(1); | 15:33 |
@wiking | ^ | 15:33 |
gf712 | what is going on here then?? | 15:33 |
@wiking | ./test.cpp:12:8: note: 'set' declared here | 15:33 |
@wiking | void set(int i) { i_ = i; } | 15:33 |
@wiking | if you create const A b; | 15:33 |
@wiking | :)_ | 15:33 |
@wiking | good q | 15:33 |
@wiking | i mean the std::ref should not call a copy ctor | 15:35 |
@wiking | but lets see probably that's whats happening | 15:35 |
@wiking | yeah | 15:37 |
gf712 | the copy ctor is being called by get | 15:37 |
@wiking | indeed | 15:38 |
@wiking | but | 15:39 |
@wiking | this is weird | 15:39 |
gf712 | so here auto is being deduced as T = A | 15:39 |
gf712 | instead of T = const A | 15:40 |
@wiking | but why? :) | 15:40 |
gf712 | because the committee thought that people use auto too much so now we need to start watching out :D | 15:49 |
gf712 | wiking but this works https://pastebin.com/ssTbmGuL after I changed std::cref to std::ref | 15:52 |
gf712 | in SGObject.cpp | 15:52 |
gf712 | ah nvm, I still had a const auto there | 15:53 |
-!- shubham808 [~atom@14.139.240.247] has quit [Ping timeout: 252 seconds] | 16:23 | |
-!- wiking [~wiking@huwico/staff/wiking] has quit [Remote host closed the connection] | 16:26 | |
-!- shubham808 [~atom@14.139.240.247] has joined #shogun | 17:00 | |
-!- Lefteris [836fb90d@gateway/web/freenode/ip.131.111.185.13] has quit [Quit: Page closed] | 17:48 | |
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun | 18:01 | |
-!- mode/#shogun [+o wiking] by ChanServ | 18:01 | |
@wiking | gf712: here? | 18:01 |
@wiking | shared_ptr is a bad idea :) | 18:01 |
@wiking | it might work for python or so | 18:02 |
@wiking | but again | 18:02 |
@wiking | most of the languages doesn't have mapping for shared_ptr in the swig typewrappers | 18:02 |
@wiking | this is why we have Some | 18:02 |
@wiking | :) | 18:02 |
@wiking | gf712: these are the 'beauty' parts of SWIG | 18:03 |
@wiking | :D | 18:03 |
gf712 | Ah ok! | 18:05 |
gf712 | I did wonder why Some existed! | 18:05 |
gf712 | Btw how can you access CMap from a target language? | 18:05 |
gf712 | I wrote a typemap for Python, is that required for the remaining languages? | 18:06 |
@wiking | mmm | 18:09 |
@wiking | one would hope that it is wrapped by swig | 18:10 |
@wiking | automatically | 18:10 |
@wiking | but your problem actually is not CMap | 18:10 |
@wiking | by AnyParameter | 18:10 |
@wiking | i think | 18:10 |
@wiking | ;) | 18:10 |
@wiking | virtual CMap<TParameter*, SGVector<float64_t> >* get_gradient( | 18:11 |
@wiking | CMap<TParameter*, CSGObject*>* parameters) | 18:11 |
@wiking | this is in Inference.h | 18:11 |
@wiking | and this should be accessible from the target lang | 18:11 |
@wiking | you should be able to call in any target language | 18:12 |
gf712 | but I have CMap<std::string, std::string>* parameter_types() const | 18:12 |
@wiking | map.get_element() | 18:12 |
@wiking | buuuut | 18:12 |
@wiking | as it's templated | 18:12 |
@wiking | :shrug: | 18:12 |
@wiking | hahahah | 18:12 |
@wiking | you know what i mean right ?:) | 18:12 |
gf712 | ahhh | 18:12 |
gf712 | do I need to %template it? | 18:13 |
@wiking | yeah | 18:13 |
gf712 | ok ok | 18:13 |
gf712 | that makes it easier | 18:13 |
@wiking | usual story | 18:13 |
gf712 | and then can access to the methods on the target language? | 18:13 |
-!- wiking_ [~wiking@2001:67c:10ec:5784:8000::3ff] has joined #shogun | 18:14 | |
-!- wiking [~wiking@huwico/staff/wiking] has quit [Read error: Connection reset by peer] | 18:14 | |
gf712 | I just find it annoying that then you don't have a nice __repr__ | 18:14 |
wiking_ | sorry something weird goiung on | 18:14 |
wiking_ | here | 18:14 |
wiking_ | with my net | 18:14 |
wiking_ | yep :( | 18:14 |
wiking_ | swig :( | 18:14 |
gf712 | no problem | 18:14 |
gf712 | not sure if you saw it but I was just saying " I just find it annoying that then you don't have a nice __repr__" | 18:14 |
gf712 | so if I do obj.parameter_types() I just see that it is wrapper in a SwigWrapper right? | 18:15 |
wiking_ | yep | 18:18 |
wiking_ | i think there's a swig trick for this | 18:19 |
-!- wiking_ is now known as wiking | 18:19 | |
-!- wiking [~wiking@2001:67c:10ec:5784:8000::3ff] has quit [Changing host] | 18:19 | |
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun | 18:19 | |
-!- mode/#shogun [+o wiking] by ChanServ | 18:19 | |
gf712 | ah ok, that would be neat, but how would it know it can iterate? | 18:19 |
@wiking | heheheh | 18:23 |
@wiking | only typemaps could solve that part imo | 18:23 |
@wiking | and again | 18:23 |
@wiking | that's very target lang spec | 18:24 |
@wiking | imo | 18:24 |
gf712 | yes, it is, but if you have the patiente and time to write the typemaps it's a cool things to have | 18:26 |
gf712 | then you can use the builtin data structures in your language.. | 18:26 |
@wiking | heheh yeah | 18:27 |
@wiking | indeed | 18:27 |
@wiking | but as you ssee from swig's repo | 18:27 |
@wiking | nobody had the patients to write the typemaps for most of the STL structs | 18:27 |
@wiking | :) | 18:27 |
gf712 | haha no, it would be so difficult to keep everything working | 18:28 |
gf712 | at least primitives work right? and string? | 18:28 |
gf712 | that's already pretty good I guess :D | 18:28 |
gf712 | anyway, got to go | 18:31 |
gf712 | talk to you later | 18:31 |
-!- gf712 [8028b333@gateway/web/freenode/ip.128.40.179.51] has quit [Quit: Page closed] | 18:31 | |
-!- abhinav_7 [76b9ec98@gateway/web/freenode/ip.118.185.236.152] has joined #shogun | 18:39 | |
-!- abhinav_7 [76b9ec98@gateway/web/freenode/ip.118.185.236.152] has left #shogun [] | 18:40 | |
-!- shubham808 [~atom@14.139.240.247] has quit [Ping timeout: 268 seconds] | 18:51 | |
-!- wiking [~wiking@huwico/staff/wiking] has quit [Remote host closed the connection] | 18:57 | |
-!- abhinav_7 [0e8be4dd@gateway/web/freenode/ip.14.139.228.221] has joined #shogun | 19:16 | |
-!- abhinav_7 [0e8be4dd@gateway/web/freenode/ip.14.139.228.221] has quit [Quit: Page closed] | 19:38 | |
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun | 20:11 | |
-!- mode/#shogun [+o wiking] by ChanServ | 20:11 | |
-!- wiking [~wiking@huwico/staff/wiking] has quit [Remote host closed the connection] | 20:43 | |
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun | 20:45 | |
-!- mode/#shogun [+o wiking] by ChanServ | 20:45 | |
-!- wiking [~wiking@huwico/staff/wiking] has quit [Remote host closed the connection] | 23:13 | |
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun | 23:14 | |
-!- mode/#shogun [+o wiking] by ChanServ | 23:14 | |
--- Log closed Wed Jan 23 00:00:39 2019 |
Generated by irclog2html.py 2.10.0 by Marius Gedminas - find it at mg.pov.lt!