I set variable x = 0. But under a while statement I changed it to x+=1. I'm trying to account for when x is in between 1 and 4 while also accounting for when x is over 4.
I have the following code:
model (features, rois) = {
convOut = convLayers (features)
roiOut = ROIPooling (convOut, rois, (9:9),spatialScale=64.0/196.0)
z = fcLayers (roiOut)
}.z
Original taken from: cntk\Examples\Image\Detection\FastRCNN\BrainScript
What is spatialScale in ROIPooling and how do I calculate it?
If have found this in the output from the cntk.exe.
Validating --> z.convOut.z.rn3.r.r = RectifiedLinear (z.convOut.z.rn3.r.r._) : [49 x 49 x 64 x *] -> [49 x 49 x 64 x *]
Validating --> rois = InputValue() : -> [4 x 1000 x *]
Validating --> z.roiOut = ROIPooling (z.convOut.z.rn3.r.r, rois) : [49 x 49 x 64 x *], [4 x 1000 x *] -> [9 x 9 x 64 x 1000 x *]
spatial scale is the ratio of the spatial resolution of the input to the ROI and the spatial resolution of the input image to the network. 1/16.0 is the value used in the original Fast and Faster R-CNN implementation, this value depend on the network.
Pretty much, spatial scale is the scale of the input to ROI relative to the original image.
Thanks,
Emad
So I am working on DSA processor that must multiply large signed values to check if they fit onto a curve. The function I am using works in python given the same values, but when passed in Verilog I am getting incorrect results. I believe it has to deal with my signed values for y & x. During testbenching multiplying x or y by itself gave incorrect values.
module on_curve (
input wire signed [511:0] point
);
reg signed [255:0] x, y;
always#*
begin
x = point[511:256];
y = point[255:0];
if ((y * y - x * x * x - 0 * x - 7) % 256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F == 0) begin
$write("This value is on the curve");
end
if ((y * y - x * x * x - 0 * x - 7) % 256'hFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F !== 0) begin
$write("This value is not on the curve");
end
end
endmodule
The value i'm using for "point" is
512'h79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8;
which is the generator point for the DSA so it should fall onto the curve.
I am super confused what the percentage sign does in Objective C. Can someone explain to me in language that an average idiot like myself can understand?! Thanks.
% is the modulo operator, so for example 10 % 3 would result in 1.
If you have some numbers a and b, a % b gives you just the remainder of a divided by b.
So in the example 10 % 3, 10 divided by 3 is 3 with remainder 1, so the answer is 1.
If there is no remainder to a divided by b, the answer is zero, so for example, 4 % 2 = 0.
Here's a relevant SO question about modular arithmetic.
Same as what it does in C, it's "modulo" (also known as integer remainder).
% is the modulo operator. It returns the remainder of <number> / <number>. For example:
5 % 2
means 5 / 2, which equals 2 with a remainder of 1, so, 1 is the value that is returned. Here's some more examples:
3 % 3 == 0 //remainder of 3/3 is 0
6 % 3 == 0 //remainder of 6/3 is 0
5 % 3 == 2 //remainder of 5/3 is 2
15 % 4 == 3 //remainder of 15/4 is 3
99 % 30 == 9 //remainder of 99/30 is 9
The definition of modulo is:
mod·u·lo
(in number theory) with respect to or using a modulus of a specified number. Two numbers are congruent modulo a given number if they give the same remainder when divided by that number.
In Mathematics, The Percentage Sign %, Called Modulo (Or Sometimes The Remainder Operator) Is A Operator Which Will Find The Remainder Of Two Numbers x And y. Mathematically Speaking, If x/y = {(z, r) : y * z + r = x}, Where All x, y, and z Are All Integers, Then
x % y = {r: ∃z: x/y = (z, r)}. So, For Example, 10 % 3 = 1.
Some Theorems And Properties About Modulo
If x < y, Then x % y = x
x % 1 = 0
x % x = 0
If n < x, Then (x + n) % x = n
x Is Even If And Only If x % 2 = 0
x Is Odd If And Only If x % 2 = 1
And Much More!
Now, One Might Ask: How Do We Find x % y? Well, Here's A Fairly Simple Way:
Do Long Division. I Could Explain How To Do It, But Instead, Here's A Link To A Page Which Explains Long Division: https://www.mathsisfun.com/numbers/long-division-index.html
Stop At Fractions. Once We Reach The Part Where We Would Normally Write The Answer As A Fraction, We Should Stop. So, For Example, 101/2 Would Be 50.5, But, As We Said, We Would Stop At The Fractions, So Our Answer Ends Up Being 50.
Output What's Left As The Answer. Here's An Example: 103/3. First, Do Long Division. 103 - 90 = 13. 13 - 12 = 1. Now, As We Said, We Stop At The Fractions. So Instead Of Continuing The Process And Getting The Answer 34.3333333..., We Get 34. And Finally, We Output The Remainder, In This Case, 1.
NOTE: Some Mathematicians Write x mod y Instead Of x % y, But Most Programming Languages Only Understand %.
All the info I can find in documentation and the web for -ffinite-math-only is "Allow optimizations for floating-point arithmetic that assume that arguments and results are not NaNs or +-Infs." This does not seem forthcoming to me. Does anyone know exactly what those optimizations are?
Thanks
Lots of little things can be optimized under that assumption, like:
x == x --> 1
x * 1 --> x
x >= y --> !(x < y) and similar.
x/x --> 1 if the compiler can prove x != 0.
it may allow a compiler to use hardware max/min instructions for expressions like x > y ? x : y.
... lots more
You often see this assumption together with assumptions like "sign of zero doesn't matter", which then allows things like:
x - x --> 0
0 / x --> 0
x * 0 --> 0