IRC logs of #shogun for Tuesday, 2019-01-22

--- 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 #shogun06:37
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun10:27
-!- mode/#shogun [+o wiking] by ChanServ10:27
-!- witness [uid10044@gateway/web/irccloud.com/x-olpljxnlfdxrhnfd] has joined #shogun10: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 #shogun11:26
-!- mode/#shogun [+o wiking] by ChanServ11:26
-!- Lefteris [836fb90d@gateway/web/freenode/ip.131.111.185.13] has joined #shogun11:39
-!- wiking [~wiking@huwico/staff/wiking] has quit [Remote host closed the connection]12:47
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun13:01
-!- mode/#shogun [+o wiking] by ChanServ13:01
-shogun-buildbot:#shogun- Build deb3 - interfaces #395 is complete: Success [build successful] - http://buildbot.shogun-toolbox.org:8080/#builders/37/builds/39513:06
-!- gf712 [8028b333@gateway/web/freenode/ip.128.40.179.51] has joined #shogun14:08
@wikinggf712: y014:24
gf712hey!14:24
gf712just saw your comment on github. Why do we need parameter_names in libshogun?14:25
@wikingwhy not? :)14:27
gf712I was thinking that you probably wouldn't use it because it's more of scripting language thing no?14:27
@wikingmmm not so sure... i mean it'd be good to be able to iterate through the params of a model14:28
gf712OK, I just removed it because no one was using it other than in a test14:30
gf712so I thought there was a better way to access that information14:30
gf712from inside the library14: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 #shogun14:46
-!- mode/#shogun [+o wiking] by ChanServ14:46
@wikinggf712: how? :)14:46
@wikinggf712: sorry i've got disconnected and this was your last msg14:48
@wiking"from inside the library "14:48
gf712yup, that was my last message14:51
gf712I am thinking how else you can get it :D14:51
@wiking:>14:52
@wikingok14:52
gf712btw std::reference_wrapper<const AnyParameter> doesn't do what I thought14:53
gf712I can easily change the values of the map14:53
gf712so I am thinking if I shouldn't return a copy in get_parameters?14:53
@wikingmmmm14:57
@wikinggood q14:57
gf712yea.. right now doing something like this `AnyParameter anyparam = each->second.get(); anyparam = a;` is enough to change the self->map15:02
gf712Which is what I wanted to avoid with the const...15:03
@wikingmmm15:05
gf712you can of course do this `const auto anyparam = each->second.get();`, but it's east to forget that const...15:10
@wikingmmm yeah15:10
@wikingi mean the return value of that map should be const values15:11
@wikingas we dont want to enable changing15:11
@wikingso probably best is to 'copy'15:11
@wikingbut i mean when u have15:11
@wikingstd::reference_wrapper<const AnyParameter> and do a get on that15:12
@wikingyou get a const anyparam no?15:12
gf712No, that's what I thought15:12
@wikingmmmmm15:13
@wikingthat is weird15:13
@wikingi mean it hsould return T&15:13
@wikingwhere T = const AnyParam15:13
gf712but get is defined like this in the standard T& get() const noexcept { return *_ptr; }15:13
@wikingok but T is = const AnyParameter15:13
@wikingno?15:13
gf712ahh wait15:14
@wikingso when u do15:14
gf712i use std::cref15:14
gf712on const AnyParameter15:14
gf712which evaluates then T = AnyParameter?15:14
gf712or isn't that how it works?15:15
gf712basically should use std:ref instead when building the map?15:15
@wikingi mean based on specs15:16
@wikingstd::cref<T>(const T& t) =  std::reference_wrapper<const T>(t)15:16
@wikingso based on this it does what you just described... i mean it returns a std::reference_wrapper<const T>15:17
@wikingi'm wondering where does the const gets dropped15:17
@wikinglemme test this in a simple code :)15:17
gf712ok, if I use std::ref I get T = const shogun::AnyParameter15:18
gf712so when I modify it I get a compiler error15:18
gf712i'm using gcc 7 btw15:18
gf712I just thought std::cref would make T const no matter what, should have read the spec better!15:21
@wikingok15:26
@wikinggf712: i've just created a simple test15:26
@wikingdoesn't look good :D15:26
@wikingbut there's somewhere a copy ctor :)15:27
gf712what do you mean? what return type do you get for get?15:27
gf712what do you test for?15:27
@wikinggf712: https://pastebin.com/xA18XRHr15:29
@wikingthis you would expect not to work/or have at leat the same values no ? :)15:29
@wiking*least15:29
@wiking11 1015:29
@wikingis the output15:29
@wiking:))))15:29
@wikingso wtf15:30
@wiking:)15:30
-!- shubham808 [~atom@14.139.240.247] has joined #shogun15:31
gf712oh, but you are changing it with a method15:31
gf712but I would expect it to print 11 1115:31
@wikingyeah at least that15:31
@wikingbut no15:32
@wiking:)15:32
@wikingbut i was expecting15:32
@wikingthat if it returns15:32
@wikingCONST A15:32
@wikingthen .set will fail15:32
@wikingon compile time15:32
gf712why would it fail at compile time?15:32
@wikingbecause you call a non const method15:32
@wikingon a const object15:32
gf712the compiler doesn't know that set changes it15:32
@wikingit's a non-const method15:32
gf712oh right15:33
@wiking./test.cpp:32:4: error: 'this' argument to member function 'set' has type 'const A', but function is not marked const15:33
@wiking   b.set(1);15:33
@wiking   ^15:33
gf712what is going on here then??15:33
@wiking./test.cpp:12:8: note: 'set' declared here15:33
@wiking                void set(int i) { i_ = i; }15:33
@wikingif you create const A b;15:33
@wiking:)_15:33
@wikinggood q15:33
@wikingi mean the std::ref should not call a copy ctor15:35
@wikingbut lets see probably that's whats happening15:35
@wikingyeah15:37
gf712the copy ctor is being called by get15:37
@wikingindeed15:38
@wikingbut15:39
@wikingthis is weird15:39
gf712so here auto is being deduced as T = A15:39
gf712instead of T = const A15:40
@wikingbut why? :)15:40
gf712because the committee thought that people use auto too much so now we need to start watching out :D15:49
gf712wiking but this works https://pastebin.com/ssTbmGuL after I changed std::cref to std::ref15:52
gf712in SGObject.cpp15:52
gf712ah nvm, I still had a const auto there15: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 #shogun17: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 #shogun18:01
-!- mode/#shogun [+o wiking] by ChanServ18:01
@wikinggf712: here?18:01
@wikingshared_ptr is a bad idea :)18:01
@wikingit might work for python or so18:02
@wikingbut again18:02
@wikingmost of the languages doesn't have mapping for shared_ptr in the swig typewrappers18:02
@wikingthis is why we have Some18:02
@wiking:)18:02
@wikinggf712: these are the 'beauty' parts of SWIG18:03
@wiking:D18:03
gf712Ah ok!18:05
gf712I did wonder why Some existed!18:05
gf712Btw how can you access CMap from a target language?18:05
gf712I wrote a typemap for Python, is that required for the remaining languages?18:06
@wikingmmm18:09
@wikingone would hope that it is wrapped by swig18:10
@wikingautomatically18:10
@wikingbut your problem actually is not CMap18:10
@wikingby AnyParameter18:10
@wikingi think18:10
@wiking;)18:10
@wiking        virtual CMap<TParameter*, SGVector<float64_t> >* get_gradient(18:11
@wiking                        CMap<TParameter*, CSGObject*>* parameters)18:11
@wikingthis is in Inference.h18:11
@wikingand this should be accessible from the target lang18:11
@wikingyou should be able to call in any target language18:12
gf712but I have CMap<std::string, std::string>* parameter_types() const18:12
@wikingmap.get_element()18:12
@wikingbuuuut18:12
@wikingas it's templated18:12
@wiking:shrug:18:12
@wikinghahahah18:12
@wikingyou know what i mean right ?:)18:12
gf712ahhh18:12
gf712do I need to %template it?18:13
@wikingyeah18:13
gf712ok ok18:13
gf712that makes it easier18:13
@wikingusual story18:13
gf712and then can access to the methods on the target language?18:13
-!- wiking_ [~wiking@2001:67c:10ec:5784:8000::3ff] has joined #shogun18:14
-!- wiking [~wiking@huwico/staff/wiking] has quit [Read error: Connection reset by peer]18:14
gf712I just find it annoying that then you don't have a nice __repr__18:14
wiking_sorry something weird goiung on18:14
wiking_here18:14
wiking_with my net18:14
wiking_yep :(18:14
wiking_swig :(18:14
gf712no problem18:14
gf712not 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
gf712so if I do obj.parameter_types() I just see that it is wrapper in a SwigWrapper right?18:15
wiking_yep18:18
wiking_i think there's a swig trick for this18:19
-!- wiking_ is now known as wiking18:19
-!- wiking [~wiking@2001:67c:10ec:5784:8000::3ff] has quit [Changing host]18:19
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun18:19
-!- mode/#shogun [+o wiking] by ChanServ18:19
gf712ah ok, that would be neat, but how would it know it can iterate?18:19
@wikingheheheh18:23
@wikingonly typemaps could solve that part imo18:23
@wikingand again18:23
@wikingthat's very target lang spec18:24
@wikingimo18:24
gf712yes, it is, but if you have the patiente and time to write the typemaps it's a cool things to have18:26
gf712then you can use the builtin data structures in your language..18:26
@wikingheheh yeah18:27
@wikingindeed18:27
@wikingbut as you ssee from swig's repo18:27
@wikingnobody had the patients to write the typemaps for most of the STL structs18:27
@wiking:)18:27
gf712haha no, it would be so difficult to keep everything working18:28
gf712at least primitives work right? and string?18:28
gf712that's already pretty good I guess :D18:28
gf712anyway, got to go18:31
gf712talk to you later18: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 #shogun18: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 #shogun19: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 #shogun20:11
-!- mode/#shogun [+o wiking] by ChanServ20:11
-!- wiking [~wiking@huwico/staff/wiking] has quit [Remote host closed the connection]20:43
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun20:45
-!- mode/#shogun [+o wiking] by ChanServ20:45
-!- wiking [~wiking@huwico/staff/wiking] has quit [Remote host closed the connection]23:13
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun23:14
-!- mode/#shogun [+o wiking] by ChanServ23: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!