我已经在Chrome(Windows10),Android和iOS上运行了我的简单tensorflow.js应用-并且正在运行。但是当我尝试在MS Edge(Windows10)上运行时,出现此错误:
Failed to create D3D shaders.
index.ts (67,1)
SCRIPT5022: Failed to link vertex and fragment shaders.
当我尝试进行预测时发生错误(因此使用了GPU):
function predict() {
var cData = ctx.getImageData(0, 0, canvas.width, canvas.height);
var cdata = cData.data;
for (var i = 0; i < cdata.length; i += 4) { // to grayscale
cdata[i] = (cdata[i] + cdata[i + 1] + cdata[i + 2]) / 3;
}
var x = tf.browser.fromPixels(cData, 1).asType('float32'); // keep only one channel
x = tf.image.resizeNearestNeighbor(x, [28, 28]); // resize
x = x.expandDims();
x = x.div(255);
var prediction;
tf.tidy(() => {
const output = model.predict(x);
const axis = 1;
prediction = Array.from(output.argMax(axis).dataSync());
preds = output.arraySync();
});
}
控制台上的打印输出:
C:\fakepath(114,28-43): warning X3556: integer divides may be much slower, try using uints if possible.
C:\fakepath(115,29-36): warning X3556: integer divides may be much slower, try using uints if possible.
C:\fakepath(106,7-48): error X3531: can't unroll loops marked with loop attribute
C:\fakepath(114,28-43): warning X3556: integer divides may be much slower, try using uints if possible.
C:\fakepath(115,29-36): warning X3556: integer divides may be much slower, try using uints if possible.
C:\fakepath(126,2-29): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\fakepath(126,2-29): error X3500: array reference cannot be used as an l-value; not natively addressable
C:\fakepath(106,7-48): error X3511: forced to unroll loop, but unrolling failed.
C:\fakepath(104,7-48): error X3511: forced to unroll loop, but unrolling failed.
Warning: D3D shader compilation failed with default flags. (ps_5_0)
Retrying with skip validation
C:\fakepath(114,28-43): warning X3556: integer divides may be much slower, try using uints if possible.
C:\fakepath(115,29-36): warning X3556: integer divides may be much slower, try using uints if possible.
C:\fakepath(126,2-29): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\fakepath(126,2-29): error X3500: array reference cannot be used as an l-value; not natively addressable
C:\fakepath(106,7-48): error X3511: forced to unroll loop, but unrolling failed.
C:\fakepath(104,7-48): error X3511: forced to unroll loop, but unrolling failed.
Warning: D3D shader compilation failed with skip validation flags. (ps_5_0)
Retrying with skip optimization
C:\fakepath(114,28-43): warning X3556: integer divides may be much slower, try using uints if possible.
C:\fakepath(115,29-36): warning X3556: integer divides may be much slower, try using uints if possible.
C:\fakepath(126,2-29): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll
C:\fakepath(126,2-29): error X3500: array reference cannot be used as an l-value; not natively addressable
C:\fakepath(106,7-48): error X3511: forced to unroll loop, but unrolling failed.
C:\fakepath(104,7-48): error X3511: forced to unroll loop, but unrolling failed.
Warning: D3D shader compilation failed with skip optimization flags. (ps_5_0)
Failed to create D3D shaders.
webgl_util.ts (155,5)
SCRIPT5022: Failed to link vertex and fragment shaders.
某些浏览器设置是否有问题? tensorflow.js是否支持Edge?我想它必须支持Edge。使用了tfjs 1.0。