lhelontra / tensorflow-on-arm

TensorFlow for Arm
MIT License
1.05k stars 274 forks source link

illegal instruction #111

Closed xiongmingzhi closed 3 years ago

xiongmingzhi commented 3 years ago

I've built a python (3.5) environment on the development board, and it's OK to run the simple tensorflow (version 1.8.0 & 1.12.0) code, but as long as I train the model, it report an error that illegal instruction, and the code is OK on the PC ! When I restore the trained model from PC, it will also report the error. I have checked many websites, but there is no similar problem. How can I solve this error? For a simple example, the code is as follows:

import tensorflow as tf import numpy as np x = np.float32(np.random.rand(100, 1)) y = np.dot(x, 0.5) + 0.7 b = tf.Variable(np.float32(0.3)) a = tf.Variable(np.float32(0.3))

y_value = tf.multiply(x, a) + b loss = tf.reduce_mean(tf.square(y_value - y)) optimizer = tf.train.GradientDescentOptimizer(0.5)

train = optimizer.minimize(loss)

init = tf.global_variables_initializer()

sess = tf.Session() sess.run(init) for step in range(0, 100): print(step) sess.run(train) if step % 10 == 0: print(step, sess.run(loss), sess.run(a), sess.run(b)) There is no problem at all when running on PC. when running on arm, the following problems appear:

0

Illegal instruction

In other words, The "sess.run (train)" error is reported, and "the sess.run() "function is on arm. I have tested that the function can run, that is, the gradient descent can not run normally; There is the problem of illegal instruction; CPU:

root@EmbedSky-Board:/xzy/mix# lscpu Architecture: armv7l Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 1 Model name: ARMv7 Processor rev 10 (v7l) CPU max MHz: 996.0000 CPU min MHz: 792.0000 root@EmbedSky-Board:/xzy/mix# cat /proc/cpuinfo processor : 0 model name : ARMv7 Processor rev 10 (v7l) BogoMIPS : 6.00 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpd32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x2 CPU part : 0xc09 CPU revision : 10