熊明之 2021-05-07 17:58 采纳率: 0%
浏览 73
已结题

illegal instruction on the arm

question:

      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.1) 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?

     举个简单的例子说明,代码如下:

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))

在PC端运行是完全没有问题的, ,,在arm 上运行,出现:

0

Illegal instruction

也就是在sess.run(train)报错,,,,sess.run() 函数在arm上,我测试过,函数可以运行,那就是梯度下降不能正常运行;出现了非法指令的问题;

arm 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

信息补充:arm来自于TQIMX6Q,armv7, NXP i.MX6Q Cortex-A9 4x1GHz, tensorflow 来自于https://www.piwheels.org/simple/;这是问题真是实在是太奇怪了!

 

 

 

 

  • 写回答

1条回答 默认 最新

  • 有问必答小助手 2021-05-08 19:10
    关注

    你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答

    本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。

    ​​​​因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。

    评论

报告相同问题?

悬赏问题

  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突