Skip to content

Instantly share code, notes, and snippets.

@Panaetius
Last active March 21, 2017 22:17
Show Gist options
  • Save Panaetius/8da26064491ab4ad1890bca3dfd86eff to your computer and use it in GitHub Desktop.
Save Panaetius/8da26064491ab4ad1890bca3dfd86eff to your computer and use it in GitHub Desktop.
Produces SIGFPE in Tensorflow
import tensorflow as tf
def test(x):
return x
with tf.Graph().as_default():
writer = tf.python_io.TFRecordWriter(
"test.tfrecords")
for i in range(1000):
example = tf.train.Example(features=tf.train.Features(feature={
'categories': tf.train.Feature(int64_list=tf.train.Int64List(
value=[]))}))
serialized = example.SerializeToString()
writer.write(serialized)
writer.close()
filename_queue = tf.train.string_input_producer(["test.tfrecords"])
reader = tf.TFRecordReader()
_, value = reader.read(filename_queue)
features = tf.parse_single_example(
value,
features={
'categories': tf.VarLenFeature(tf.int64)
})
cats = features['categories']
cats = tf.train.shuffle_batch(
[cats],
batch_size=1,
num_threads=16,
capacity=13,
min_after_dequeue=10)
c = tf.sparse_tensor_to_dense(cats)
c = c[0]
proposed_box = [[1.1240276, 1.3511111, 2.2480552, 2.7022221],[19.190971, 1.3511111, -0.38193941, 2.7022221],[14.690802, 4.5090837, 4.2582755, 4.0533333],[12.878634, 2.0111012, 7.0371451, 4.0222025],[0.90662462, 9.5, 1.8132492, 19],[0.78251761, 9.5, 1.5650352, 19],[14.690802, 3.9975617, 5.4508338, 6.1962109],[1.2288997, 2.2734833, 2.4577994, 4.5469666],[1.3772627, 0.82828814, 2.7545254, 1.6565763],[26.791367, 0.67555553, -15.58273, 1.3511111],[25.2317, 1.8697553, -12.463403, 3.7395105],[4.7773132, 1.3511111, 9.5546265, 2.7022221],[20.442099, 1.8363502, -2.8841987, 3.6727004],[6.8423038, 1.6748983, 11.864125, 3.3497968],[23.509773, 1.1891305, -9.0195494, 2.3782611],[14.690802, 4.4225116, 7.6133571, 4.0533333],[3.4162774, 1.0133333, 4.0533333, 2.0266666],[8.7958612, 2.4065683, 10.808888, 4.8131366],[2.7022221, 5.6312871, 1.8998148, 11.262574],[22.29912, 0.72665209, -6.5982385, 1.4533042],[3.8128009, 1.0133333, 4.983933, 2.0266666],[26.37825, 2.283478, -14.756503, 3.4379423],[8.2235012, 1.0133333, 5.4910774, 2.0266666],[0.69783992, 1.9550363, 1.3956798, 1.219772],[10.035634, 2.4467711, 6.553679, 4.8935423],[11.654949, 1.3511111, 14.690101, 2.7022221],[1.3772627, 1.7722435, 2.7545254, 2.6527865],[1.3080401, 3.3692875, 2.61608, 6.738575],[20.1656, 2.2001297, -2.3312011, 4.4002595],[14.690802, 4.7586508, 6.2989726, 6.2255783],[14.690802, 4.6173921, 7.0661054, 5.2046366],[14.690802, 3.5665789, 4.0533333, 7.1331577],[2.7022221, 9.4327278, 2.1683521, 14.690802],[9.2027721, 3.5965276, 10.808888, 5.4044442],[0.67555553, 3.6727004, 1.3511111, 1.3545198],[14.690802, 2.0644746, 6.2691336, 4.1289492],[14.690802, 5.4397244, 5.90782, 4.9177341],[15.859619, 1.8363502, 1.3511111, 3.6727004],[3.1373122, 1.2325504, 5.2360024, 2.4651008],[6.7934055, 1.8449324, 11.018102, 3.6898649],[16.906481, 1.7344897, 1.3511111, 3.4689794],[13.614178, 2.008661, 4.0533333, 4.0173221],[8.9141817, 1.3511111, 10.808888, 2.7022221],[1.9511868, 1.3511111, 3.9023736, 2.7022221],[3.6240153, 3.6727004, 3.6949577, 4.3584242],[12.28604, 1.5624561, 4.3025813, 3.1249123],[4.450913, 1.0828733, 5.0278125, 2.1657467],[14.13109, 1.0674993, 4.0533333, 2.1349986],[5.933013, 2.1002822, 8.27533, 4.2005644],[1.2316703, 3.8260283, 2.4633405, 7.6520567],[1.0652514, 4.2598629, 2.1305027, 8.5197258],[1.3772627, 1.002556, 2.7545254, 2.0051119],[29.610281, 0.88012481, -21.220564, 1.7602496],[14.690802, 5.2745323, 5.1115508, 4.0533333],[18.04747, 9.4994555, 1.9050593, 2.7022221],[16.828739, 4.140038, 1.3728266, 5.4044442],[1.686619, 2.7022221, 3.3732381, 3.6907482],[2.7022221, 10.760407, 1.0602993, 14.690802],[2.2147338, 1.3511111, 4.4294677, 2.7022221],[10.115388, 1.3511111, 10.808888, 2.7022221],[8.6154442, 3.9157867, 10.808888, 5.4044442],[1.3772627, 3.1302738, 2.7545254, 2.0266666],[16.48472, 2.4153919, 2.2443206, 4.8307838],[29.139011, 2.9044936, -20.278021, 3.1500907],[14.690802, 5.5360484, 6.2664795, 5.1222558],[1.3772627, 3.0425282, 2.7545254, 2.3595619],[6.444324, 1.3511111, 10.808888, 2.7022221],[0.67555553, 0.33777776, 1.3511111, 0.67555553],[14.690802, 5.3174639, 6.3667159, 4.9609656],[11.768026, 1.0133333, 5.4959478, 2.0266666],[0.91842347, 4.3308172, 1.8368469, 8.6616344],[11.76758, 1.7326281, 5.1799521, 3.4652562],[14.690802, 6.05191, 4.5662231, 5.3202281],[9.0677042, 1.3511111, 14.779294, 2.7022221],[25.449354, 2.5273089, -12.898709, 5.0546179],[14.690802, 4.4248819, 5.6988788, 5.7872286],[3.0226345, 1.0133333, 6.045269, 2.0266666],[4.6947279, 5.4044442, 9.3894558, 4.3992672],[14.690802, 5.6920614, 4.6366048, 5.2188272],[14.690802, 4.8734651, 4.0533333, 4.0533333],[3.9145131, 2.0514469, 7.8290262, 4.1028938],[25.341503, 1.2467246, -12.683003, 2.4934492],[6.0467381, 1.1495395, 4.5975132, 2.2990789],[0.80015337, 3.8997698, 1.6003067, 7.7995396],[0.86914074, 2.3016315, 1.7382815, 3.7759554],[7.9700413, 1.0133333, 7.6811309, 2.0266666],[11.516705, 1.7040431, 9.0092354, 3.4080863],[7.7843156, 1.3511111, 10.808888, 2.7022221],[21.234041, 2.9480155, -4.468081, 2.7022221],[1.217379, 3.723794, 2.4347579, 7.447588],[9.4544344, 1.3511111, 13.278443, 2.7022221],[7.7621155, 3.1292217, 10.808888, 5.4044442],[0.925773, 1.3655723, 1.851546, 2.1584644],[3.2738991, 3.6727004, 5.1786871, 6.5556636],[14.690802, 2.5442729, 4.0533333, 4.5116234],[0.67555553, 2.5912619, 1.3511111, 1.3511111],[10.530693, 4.1742792, 10.808888, 5.4044442],[20.089092, 1.5781562, -2.178185, 3.1563125],[3.751492, 3.6727004, 2.7022221, 2.8013327],[14.690802, 3.7737584, 8.5860739, 4.0533333],[14.690802, 2.1006875, 4.515636, 4.201375],[0.82407188, 1.9404203, 1.6481438, 1.9031872],[13.990232, 3.6094172, 10.019534, 5.4044442],[1.7324759, 1.0133333, 3.4649518, 2.0266666],[12.555563, 1.3511111, 10.808888, 2.7022221],[1.3072172, 1.351681, 2.6144345, 2.703362],[14.690802, 3.7033472, 4.1727219, 4.0533333],[22.251385, 3.7640214, -6.5027666, 2.7139328],[7.4470334, 1.0546443, 4.0845194, 2.1092887],[0.67555553, 1.672815, 1.3511111, 1.3511111],[14.690802, 2.8721375, 5.6543217, 5.6190658],[0.67555553, 0.5682379, 1.3511111, 1.1364758],[10.921062, 1.3511111, 10.808888, 2.7022221],[9.5390949, 1.0133333, 5.9092183, 2.0266666],[14.690802, 4.3914618, 8.0655842, 6.4618845],[0.67555553, 1.8192143, 1.3511111, 1.3511111],[7.4875269, 4.9922137, 10.808888, 5.4044442],[10.761857, 1.3511111, 10.808888, 2.7022221],[14.690802, 1.5733415, 4.957231, 3.146683],[1.8198773, 6.0472145, 3.6397545, 12.094429],[14.690802, 1.1622486, 6.6690621, 2.3244972],[14.690802, 4.7820096, 4.3761487, 4.2166333],[1.3772627, 6.9016452, 2.7545254, 5.1271825],[4.7770004, 3.9347119, 9.5540009, 5.4044442],[4.217495, 1.7076695, 8.43499, 3.415339],[5.8944588, 7.1963472, 10.808888, 5.4044442],[12.391203, 1.1227355, 1.8373973, 2.245471],[14.690802, 1.0133333, 8.4115, 2.0266666],[18.124516, 1.090728, 1.7509704, 2.1814561],[22.528154, 5.22234, -7.0563068, 4.5438752],[1.3772627, 4.9401298, 2.7545254, 2.0266666],[3.8973475, 1.1652162, 6.3055787, 2.3304324],[5.3601866, 2.7993231, 10.720373, 5.4044442],[14.690802, 6.6691742, 7.6927209, 6.2431984],[14.329462, 3.7893195, 9.3410759, 4.130321],[14.690802, 3.4701746, 4.0533333, 4.6532826],[0.67555553, 1.1071281, 1.3511111, 1.3511111],[10.823267, 1.3511111, 10.808888, 2.7022221],[6.0353522, 3.6727004, 3.4036283, 2.4273779],[0.67555553, 1.2587038, 1.3511111, 1.3511111],[9.0391665, 1.0133333, 4.0533333, 2.0266666],[0.78270733, 11.8297, 1.5654145, 1.3511111],[14.690802, 4.114553, 4.759717, 4.0922494],[1.3772627, 1.1273572, 2.7545254, 2.2547145],[2.7022221, 5.844903, 3.5671792, 11.689806],[6.4688573, 2.2981095, 10.808888, 4.5962191],[1.2390258, 13.552385, 2.4780517, 10.895228],[0.67555553, 4.9052339, 1.3511111, 1.3511111],[1.3772627, 0.50666666, 2.7545254, 1.0133333],[0.67555553, 7.0685906, 1.3511111, 1.3511111],[14.690802, 12.326191, 4.7097044, 4.0533333],[8.1066666, 17.81588, 10.449978, 2.3682413],[10.261899, 2.3879852, 10.808888, 4.7759705],[1.3772627, 4.3466811, 2.7545254, 3.2769976],[5.3364391, 1.3094084, 4.4806223, 2.6188169],[4.5837831, 3.1425552, 9.1675663, 5.4044442],[20.090527, 2.7452748, -2.1810517, 5.4905496],[0.67555553, 0.85039204, 1.3511111, 1.3511111],[6.7635732, 6.7690959, 10.808888, 5.4044442],[17.156733, 1.1920714, 3.3189895, 2.3841429],[5.6702104, 5.4044442, 5.4866633, 4.3607445],[7.6836424, 5.8925967, 10.808888, 5.4044442],[10.350867, 1.472506, 5.6615624, 2.9450121],[1.3772627, 2.7380986, 2.7545254, 2.0492],[4.7353125, 5.7481871, 9.4706249, 5.4044442],[4.8869886, 7.6363592, 9.7739773, 5.4044442],[9.8311529, 3.7253602, 10.514194, 4.1646013],[0.67555553, 1.2132696, 1.3511111, 1.3511111],[1.3772627, 1.745357, 2.7545254, 2.0266666],[14.690802, 2.2182677, 7.41202, 4.0533333],[4.5313697, 5.4044442, 1.8306248, 2.7677879],[4.506196, 3.8858113, 3.8283105, 7.7716227],[1.1310205, 12.925029, 2.2620411, 12.149941],[1.3772627, 7.0739908, 2.7545254, 2.0266666],[1.3772627, 3.7427337, 2.7545254, 2.0266666],[14.690802, 5.0643506, 6.2078824, 4.7778325],[4.7843595, 1.0211021, 5.1007071, 2.0422041],[0.67555553, 3.6727004, 1.3511111, 3.1778705],[21.08667, 1.8382082, -4.1733389, 3.6764164],[14.690802, 1.6726325, 4.0533333, 3.3452649],[0.67555553, 0.5143674, 1.3511111, 1.0287348],[0.71459413, 3.2762985, 1.4291883, 2.4550526],[1.8283079, 4.4358149, 2.7022221, 1.3511111],[5.2815013, 1.8886907, 6.4610047, 3.7773814],[7.9723725, 1.9100192, 5.891592, 3.8200383],[0.90800983, 1.3511111, 1.8160197, 1.362632],[14.690802, 4.8367915, 8.0149336, 5.2093892],[0.84253788, 14.534275, 1.6850758, 8.9314489],[0.50666666, 9.5, 1.0133333, 19],[14.690802, 4.3442454, 6.9646921, 4.2647758],[1.3772627, 10.658646, 2.7545254, 2.0266666],[0.50666666, 4.6684618, 1.0133333, 9.3369236],[14.18428, 1.0133333, 9.6314392, 2.0266666],[8.1066666, 13.725664, 3.4352646, 5.4044442],[3.5719023, 10.306485, 7.1438046, 14.690802],[1.3772627, 1.3537688, 2.7545254, 2.0266666],[3.6727004, 1.3192749, 7.3454008, 2.6385498],[6.527842, 4.6136436, 10.808888, 5.4044442],[7.8958092, 1.0133333, 8.6060419, 2.0266666],[10.550531, 1.3511111, 10.808888, 2.7022221],[1.2315869, 13.015983, 2.4631739, 11.968035],[1.0728066, 3.6420832, 2.1456132, 7.2841663],[8.1956253, 1.4272368, 7.362042, 2.8544736],[16.258587, 1.0881188, 2.2202721, 2.1762376],[1.1329961, 6.9176435, 2.2659922, 1.3511111],[1.6272818, 6.6708069, 2.8259525, 1.523236],[12.822881, 4.8353047, 8.9620075, 4.0533333],[4.8909597, 4.8418741, 9.7819195, 5.4044442],[7.0086231, 1.2625546, 7.4645071, 2.5251093],[0.76316684, 3.6727004, 1.5263337, 3.8841224],[1.1159115, 13.810276, 2.231823, 10.379446],[16.953398, 0.769517, 3.6727004, 1.539034],[11.234943, 1.3511111, 10.808888, 2.7022221],[19.05579, 3.3273189, -0.11158228, 6.1463203],[2.3396003, 2.1322646, 2.7022221, 1.3511111],[8.1066666, 16.621593, 9.473073, 4.756814],[0.52860236, 9.5, 1.0572047, 19],[3.983273, 4.9487143, 4.821589, 9.8974285],[1.2271253, 14.593249, 2.4542506, 8.8135014],[6.6586456, 1.0798504, 6.0425358, 2.1597009],[1.1747605, 14.690802, 2.3495209, 6.6286345],[0.88210213, 0.82040977, 1.7642043, 1.6408195],[5.0880938, 3.6727004, 5.8545737, 5.942152],[4.4578543, 8.1066666, 8.9157085, 1.5367439],[13.447155, 2.6515241, 2.0281098, 5.3030477],[4.3523464, 0.74125928, 8.7046938, 1.4825186],[0.7349059, 14.690802, 1.4698118, 5.7251425],[1.3772627, 1.6141522, 2.7545254, 2.0266666],[1.6133858, 2.9094751, 3.2267716, 2.8178589],[7.949873, 2.3046532, 10.808888, 4.6093063],[4.4172049, 3.7792449, 5.4044442, 7.55849],[1.0507287, 0.50700617, 2.1014574, 1.0140123],[1.3772627, 2.9440236, 2.7545254, 2.9709582],[2.97194, 6.4893365, 2.2583563, 12.978673],[8.1066666, 17.81588, 7.9101129, 2.3682413],[0.77034622, 1.0275989, 1.5406924, 2.0551977],[1.1997125, 5.5090504, 2.399425, 11.018101],[1.4495676, 4.5874944, 2.8991351, 1.5813663],[1.6739019, 0.33777776, 2.7022221, 0.67555553],[0.50666666, 12.247191, 1.0133333, 8.886343],[0.92545211, 5.6771259, 1.8509042, 1.3511111],[2.668026, 3.7942991, 5.3360519, 7.5885983],[3.4501827, 4.8223863, 6.9003654, 9.6447725],[4.766057, 3.5533919, 2.7022221, 1.5815567],[6.6010666, 0.85099435, 13.202133, 1.7019887],[1.3772627, 3.4061344, 2.7545254, 4.1432896],[2.4023688, 7.0610371, 2.7022221, 1.3511111],[3.3085203, 8.1066666, 6.6170406, 2.4728916],[1.3772627, 3.036458, 2.7545254, 3.4103515],[8.0109425, 0.67555553, 14.690802, 1.3511111],[2.6003377, 1.5479311, 2.7022221, 1.6566769],[2.0643404, 1.3511111, 4.0533333, 2.7022221],[1.8330432, 1.1108103, 2.7022221, 1.3511111],[1.028833, 4.4540749, 2.0576661, 7.5330496],[5.4972878, 6.2415447, 4.0533333, 5.4044442],[1.1209037, 1.7592535, 2.2418075, 1.3511111]]
num_regions = tf.shape(proposed_box)[0]
label_regs = tf.reshape(tf.tile(c, [num_regions]),
[num_regions, -1, 4])
num_labs = tf.shape(label_regs)[1]
regions2 = tf.reshape(tf.tile(proposed_box, [1, num_labs]),
[num_regions, num_labs, 4])
test = tf.map_fn(
lambda x: test(x[0]),
[regions2], dtype=tf.float32)
with tf.Session() as sess:
init = tf.global_variables_initializer()
sess.run(init)
# Start the queue runners.
tf.train.start_queue_runners(sess=sess)
sess.run([test])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment