Filter löschen
Filter löschen

在matlab function中导​入net,但是出现了​以下问题,尝试过6.​3和8.1版本的Mi​nG64,但是一直报​错。Deep learning code generation using MinGW64 Compiler (C++) toolchain is not supported for mkldnn target.

10 Ansichten (letzte 30 Tage)

Akzeptierte Antwort

Angelo Yeo
Angelo Yeo am 20 Mai 2024
MinGW is not supported for this workflow yet. Would you install the Visual Studio 2022 and use its compiler? See the webpage below for instruction
Next, in the command window, enter "mex -setup c++" command and select Visual Studio compiler for C++ Compilation, and see if the workflow works.
For more information, see the doc below.
  11 Kommentare
Angelo Yeo
Angelo Yeo am 22 Mai 2024
Bearbeitet: Angelo Yeo am 22 Mai 2024
Hi @guiyang, thank you so much for sharing the model. I will share it with dev team and report the issue. Also, it's great to know that you had some progress.
The new issue is about checking validity of custom layer. The issue is described in the docs below.
There must be multiple classes generated for the imported model like "aten_linear0.m". Would you add the %#codegen pragma for all the custom layer classes and see if you can fix the issue?
guiyang
guiyang am 24 Mai 2024
我加入了%#codegen,它显示了具体错误,错误如下Code generation for custom layer 'aten__linear0' for target 'mkldnn' is not supported as it returns a dlarray object with data format 'UU' as output 'out'.我尝试了各种方法但是并没有有效解决。
classdef aten__linear0 < nnet.layer.Layer & nnet.layer.Formattable & ...
nnet.layer.AutogeneratedFromPyTorch & nnet.layer.Acceleratable
%aten__linear0 Auto-generated custom layer
% Auto-generated by MATLAB on 2024-05-24 10:16:56
%#codegen
properties (Learnable)
% Networks (type dlnetwork)
end
properties
% Non-Trainable Parameters
end
properties (Learnable)
% Trainable Parameters
Param_weight
Param_bias
end
methods
function obj = aten__linear0(Name, Type, InputNames, OutputNames)
obj.Name = Name;
obj.Type = Type;
obj.NumInputs = 1;
obj.NumOutputs = 1;
obj.InputNames = InputNames;
obj.OutputNames = OutputNames;
end
function [linear_9] = predict(obj,linear_x_1)
%Validates that the input has the correct format and permutes its dimensions into the reverse of the original PyTorch format.
model_tt.ops.validateInput(linear_x_1,2);
[linear_x_1, linear_x_1_format] = model_tt.ops.permuteInputToReversePyTorch(linear_x_1, 2);
[linear_x_1] = struct('value', linear_x_1, 'rank', int64(2));
[linear_9] = tracedPyTorchFunction(obj,linear_x_1,false,"predict");
%Permute U-labelled output to forward PyTorch dimension ordering
if(any(dims(linear_9.value) == 'U'))
linear_9 = permute(linear_9.value, fliplr(1:max(2,linear_9.rank)));
end
end
function [linear_9] = forward(obj,linear_x_1)
%Validates that the input has the correct format and permutes its dimensions into the reverse of the original PyTorch format.
model_tt.ops.validateInput(linear_x_1,2);
[linear_x_1, linear_x_1_format] = model_tt.ops.permuteInputToReversePyTorch(linear_x_1, 2);
[linear_x_1] = struct('value', linear_x_1, 'rank', int64(2));
[linear_9] = tracedPyTorchFunction(obj,linear_x_1,true,"forward");
%Permute U-labelled output to forward PyTorch dimension ordering
if(any(dims(linear_9.value) == 'U'))
linear_9 = permute(linear_9.value, fliplr(1:max(2,linear_9.rank)));
end
end
function [linear_9] = tracedPyTorchFunction(obj,linear_x_1,isForward,predict)
linear_weight_1 = obj.Param_weight;
[linear_weight_1] = struct('value', dlarray(linear_weight_1,'UU'), 'rank', 2);
linear_bias_1 = obj.Param_bias;
[linear_bias_1] = struct('value', dlarray(linear_bias_1,'UU'), 'rank', 1);
[linear_9] = model_tt.ops.pyLinear(linear_x_1, linear_weight_1, linear_bias_1);
end
end
end

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Deep Learning Code Generation Fundamentals finden Sie in Help Center und File Exchange

Produkte


Version

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by