optimization

Optimize input image with class prior

佐手、 提交于 2020-01-15 07:13:29
问题 I'm trying to implement the first part of the google blog entry Inceptionism: Going Deeper into Neural Networks in TensorFlow. So far I have found several resources that either explain it in natural language or focus on other parts or give code snippets for other frameworks. I understand the idea of optimizing a random input image with respect to a class prior and also the maths behind it given in the this paper, section 2, but I'm not able to implement it myself using TensorFlow. From this

Optimize input image with class prior

大城市里の小女人 提交于 2020-01-15 07:11:16
问题 I'm trying to implement the first part of the google blog entry Inceptionism: Going Deeper into Neural Networks in TensorFlow. So far I have found several resources that either explain it in natural language or focus on other parts or give code snippets for other frameworks. I understand the idea of optimizing a random input image with respect to a class prior and also the maths behind it given in the this paper, section 2, but I'm not able to implement it myself using TensorFlow. From this

Algorithms for optimal student seating arrangements

吃可爱长大的小学妹 提交于 2020-01-15 06:28:08
问题 Say I need to place n=30 students into groups of between 2 and 6, and I collect the following preference data from each student: Student Name: Tom Likes to sit with: Jimi, Eric Doesn't like to sit with: John, Paul, Ringo, George It's implied that they're neutral about any other student in the overall class that they haven't mentioned. How might I best run a large number of simulations of many different/random grouping arrangements, to be able to determine a score for each arrangement, through

Can Compiler Optimize Loop with Variable Length?

家住魔仙堡 提交于 2020-01-15 05:07:14
问题 Can the compiler optimize loops if the last index of the loops ( a and b in the following example) are not known at compile time? Unoptimized: int* arr = new int[a*b]; for (i = 0; i < a; ++i){ for(j = 0; j < b; ++j){ arr[i*b+j] *= 8; } } //delete arr after done. More Optimized: (assuming a and b are large...) int c = a*b; int* arr = new int[c]; for (i = 0; i < c; ++i){ arr[c] *= 8; } //delete arr after done. 回答1: If you treat the array as linear space, gcc (and presumably others) will

Long latency instruction

我怕爱的太早我们不能终老 提交于 2020-01-14 19:39:12
问题 I would like a long-latency single-uop x86 1 instruction, in order to create long dependency chains as part of testing microarchitectural features. Currently I'm using fsqrt , but I'm wondering is there is something better. Ideally, the instruction will score well on the following criteria: Long latency Stable/fixed latency One or a few uops (especially: not microcoded) Consumes as few uarch resources as possible (load/store buffers, page walkers, etc) Able to chain (latency-wise) with itself

Improving performance of a function in python

假装没事ソ 提交于 2020-01-14 19:21:32
问题 I have a text file fo several GB with this format 0 274 593869.99 6734999.96 121.83 1, 0 273 593869.51 6734999.92 121.57 1, 0 273 593869.15 6734999.89 121.57 1, 0 273 593868.79 6734999.86 121.65 1, 0 273 593868.44 6734999.84 121.65 1, 0 273 593869.00 6734999.94 124.21 1, 0 273 593868.68 6734999.92 124.32 1, 0 273 593868.39 6734999.90 124.44 1, 0 273 593866.94 6734999.71 121.37 1, 0 273 593868.73 6734999.99 127.28 1, I have a simple function to filter in Python 2.7 on Windows. The function

Improving performance of a function in python

痴心易碎 提交于 2020-01-14 19:21:09
问题 I have a text file fo several GB with this format 0 274 593869.99 6734999.96 121.83 1, 0 273 593869.51 6734999.92 121.57 1, 0 273 593869.15 6734999.89 121.57 1, 0 273 593868.79 6734999.86 121.65 1, 0 273 593868.44 6734999.84 121.65 1, 0 273 593869.00 6734999.94 124.21 1, 0 273 593868.68 6734999.92 124.32 1, 0 273 593868.39 6734999.90 124.44 1, 0 273 593866.94 6734999.71 121.37 1, 0 273 593868.73 6734999.99 127.28 1, I have a simple function to filter in Python 2.7 on Windows. The function

Can I get a C++ Compiler to instantiate objects at compile time?

扶醉桌前 提交于 2020-01-14 19:13:06
问题 I am writing some code that has a very large number of reasonably simple objects and I would like them the be created at compile time. I would think that a compiler would be able to do this, but I have not been able to figure out how. In C I could do the the following: #include <stdio.h> typedef struct data_s { int a; int b; char *c; } info; info list[] = { 1, 2, "a", 3, 4, "b", }; main() { int i; for (i = 0; i < sizeof(list)/sizeof(*list); i++) { printf("%d %s\n", i, list[i].c); } } Using #C

manual grayscale in opencv is too slow

守給你的承諾、 提交于 2020-01-14 18:50:33
问题 Note: I have to do this manually so don't suggest me to use the library function cvtColor(). I'm new to opencv and I am trying to grayscale an color image with the formula (r,g,b) = (r,g,b)/((r+g+b)/3) Here is my method(C++) for converting to grayscale: Mat dst = src.clone(); for (int i= 0; i<src.rows; ++i) { for (int j = 0 ; j < src.cols; ++j) { Vec3b myVec = dst.at<Vec3b>(i,j); uchar temp = (myVec[0]+myVec[1]+myVec[2])/3; Vec3b newPoint(temp,temp,temp); dst.at<Vec3b>(i,j) = newPoint ; } }

manual grayscale in opencv is too slow

微笑、不失礼 提交于 2020-01-14 18:50:14
问题 Note: I have to do this manually so don't suggest me to use the library function cvtColor(). I'm new to opencv and I am trying to grayscale an color image with the formula (r,g,b) = (r,g,b)/((r+g+b)/3) Here is my method(C++) for converting to grayscale: Mat dst = src.clone(); for (int i= 0; i<src.rows; ++i) { for (int j = 0 ; j < src.cols; ++j) { Vec3b myVec = dst.at<Vec3b>(i,j); uchar temp = (myVec[0]+myVec[1]+myVec[2])/3; Vec3b newPoint(temp,temp,temp); dst.at<Vec3b>(i,j) = newPoint ; } }