what is the difference between robolectric and androidx.test? - junit

Can some one explain me How it makes difference when i use robolectric seperately with gradle along with androidx.test and just use androix.test without roboelectric.
I have found some article which is saying that , latest version of robolectric support androidx.test , but not much examples about this , so i am little confused about how really this combination will work and helpful in writing unit test.
Any help regarding this query is appreciated.

Related

MXNet AdamW optimizer

Adam optimizer has flaws when used with weight decay. In 2018, AdamW optimizer has been proposed.
Is there any standard way to implement AdamW in MXNet framework (python implementation)? There is mxnet.optimizer.Adam class, but no mxnet.optimizer.AdamW one (checked in mxnet-cu102==1.6.0, mxnet==1.5.0 package versions).
P.S. I asked this questions on MXNet forum and on datascience.stackexchange.com, but to no avail.
Short answer: There isn't a standard way to use AdamW in Gluon yet, but there is some existing work in that direction that would make that relatively easy to add.
Longer answer:
People have been asking for this feature - a lot :) See: https://github.com/apache/incubator-mxnet/issues/9182
Gluon-NLP has a working version of AdamW - possibly slightly different from the one in the original paper: https://github.com/eric-haibin-lin/gluon-nlp/blob/df63e2c2a4d6b998289c25a38ffec8f4ff647ff4/src/gluonnlp/optimizer/bert_adam.py
The adamw_update() operator was added with this pull request: https://github.com/apache/incubator-mxnet/pull/13728 This is first released in MXNet 1.6.0.
Unfortunately, it looks like there isn't a way to use this with gluon.Trainer directly right now, without copying/modifying the BERTAdam code (or writing something similar from scratch). That would be a very nice thing to add to Gluon.
Please let me know if you get this working, as I'd love to be able to use that as well.

For loop representation in Chisel (#Normalization in Float Adder)

I try to code floating adder;
https://github.com/ElectronNest/FPU/blob/master/FloatAdd.scala
This is half way.
The normalization is huge code part, so I would like to use for-loop or some equivalent representation method.
Is it possible to use loop or we need strict coding?
Best,
S.Takano
This is a very general and large question. The equivalent of a for loop in hardware can be implemented using a number of techniques, pretty much all of them involving registers to hold state information. Looking at your code I would suggest that you start a little smaller and work on syntax, I see many syntax errors currently. I use IntelliJ community edition as an editor because it does a great job with helping to get the code properly structured. I also would strongly recommend starting from the chisel-template repository. It has the proper layout and examples of a working circuit and unit testing harness. Then start with a smaller implementation that does something simple like just pass input to output and runs in a test harness, then slowly build up the circuit to achieve your goals.
Good luck!
Welcome and thank you for your interest in Chisel!
I would like to echo Chick's suggestion to start from something small that compiles and simulates and build up from there. In particular, the linked code above conflates some Scala vs. Chisel constructs (eg. Scala's if else, vs. Chisel's when, .elsewhen, .otherwise), as well as some Verilog vs. Chisel concepts (eg. bit indexing with [high:low] vs. Chisel's (high, low))
In case you haven't seen it, I would suggest taking a look at the Chisel Bootcamp which helps explain how to use constructs like for loops to generate hardware.
I'll also plug my own responses to this question on the chisel-users mailing list where I tried to explain some of the intuition behind writing Chisel generators, including differentiating if and when and using for loops.

.NET WebApi jsonapi.org support

Does anyone know if there is a media formatter out there to support the jsonapi.org spec (application/vnd.api+json).
If not has anyone started (or looking at starting) a project to implement this?
For the record, as of today the answer seems to be no. Best I could find was this guy: http://www.emadibrahim.com/2014/04/09/emberjs-and-asp-net-web-api-and-json-serialization/ and that only tackles a tiny part of the problem.
I've been trying this for a while…unfortunately I tried to make something that was really smart and would automagically handle a data model from Entity Framework with almost no work. I was getting close to thinking about releasing it...and then I found out they changed a bunch of stuff in EF 6 (all models are supposed to be POCOs and the context is now a DbContext instead of an ObjectContext) and I'm probably going to have to essentially start over…which is why I started looking again to see if someone else was doing it and found your question.
Let me know if you're still looking for this, and I'll keep you updated.
UPDATE
I've just published a codeplex project that aims to provide exactly what I've described above. It's called JSONAPI.NET and while it's very early, it already does quite a bit. Documentation is sparse, and I don't have NuGet packages yet…but take a look everyone and see if it's useful for you. Feedback is encouraged! You can contact me from the project page in the link.

making query using asyncdynamo

I am using asyncdynamo library to interact with Amazon Dynamo DB. I can successfully get items using get_item() but don't know how to format a query for it. I have tried different patterns but got no luck. The Library itself doesn't have any documentation to provide the information on this.
If someone else has used and made queries using asyncdynamo then please help.
The lack of documentation for Asyncdynamo really kills the usefulness of the project. You might consider using Dynochemy instead, since at least it has some examples:
https://github.com/rhettg/Dynochemy

Do you use the debugger of the language to understand code?

Do you use the debugger of the language that you work in to step through code to understand what the code is doing, or do you find it easy to look at code written by someone else to figure out what is going on? I am talking about code written in C#, but it could be any language.
I use the unit tests for this.
Yes, but generally only to investigate bugs that prove resistant to other methods.
I write embedded software, so running a debugger normally involves having to physically plug a debug module into the PCB under test, add/remove links, solder on a debug socket (if not already present), etc - hence why I try to avoid it if possible. Also, some older debugger hardware/software can be a bit flaky.
I will for particularly complex sections of code, but I hope that generally my fellow developers would have written code that is clear enough to follow without it.
Depending on who wrote the code, even a debugger doesn't help to understand how it works: I have a co-worker who prides himself on being able to get as much as possible done in every single line of code. This can lead to code that is often hard to read, let alone understand what it does in the long run.
Personally I always hope to find code as readable as the code I try to write.
I will mostly use debugger to setup breakpoints on exceptions.
That way I can execute any test or unit test I wrote, and still be able to be right where the code fails if any exception should occur.
I won't say I used all the time, but I do use it fairly often. The domain I work in is automation and controls. You often need the debugger to see the various internal states of the system. It is usually difficult to impossible to determine these simply from looking at code.
Yes, but only as a last resort when there's no unit test coverage and the code is particularly hard to follow. Using the debugger to step through code is a time consuming process and one I don't find too fun. I tend to find myself using this technique a lot when trying to follow VBA code.