MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / PrepareAndExecuteNet

Method PrepareAndExecuteNet

tensorflow/core/kernels/mkl_conv_ops.cc:1043–1082  ·  view source on GitHub ↗

TODO(intel-mkl): This function does not seem to be called. Remove it. Prepare and execute net - checks for input and output reorders.

Source from the content-addressed store, hash-verified

1041 // TODO(intel-mkl): This function does not seem to be called. Remove it.
1042 // Prepare and execute net - checks for input and output reorders.
1043 void PrepareAndExecuteNet(const ConvFwdPd& conv_prim_desc,
1044 MklDnnData<Tinput>* src,
1045 MklDnnData<Tfilter>* filter,
1046 MklDnnData<Tbias>* bias,
1047 MklDnnData<Toutput>* output,
1048 Tensor* filter_out_tensor) {
1049 DCHECK(filter_out_tensor);
1050
1051 // Create reorders between user layout and OneDNN layout if it is needed and
1052 // add it to the net before convolution. No need to check for output
1053 // reorder as we propagate output layout to the next layer.
1054 src->CheckReorderToOpMem(
1055 MEMORY_PD_WITHOUT_DATA(conv_prim_desc.PRIMITIVE_DESC_SRC, cpu_engine_));
1056
1057 // Rather than re-ordering to a temp buffer, reorder directly to the
1058 // filter output tensor
1059 filter->CheckReorderToOpMem(conv_prim_desc.PRIMITIVE_DESC_WEIGHTS,
1060 filter->GetTensorBuffer(filter_out_tensor));
1061
1062 // Create convolution primitive and add it to net.
1063 std::vector<primitive> net;
1064 std::vector<std::unordered_map<int, memory>> net_args;
1065 if (bias) {
1066 DCHECK(fuse_biasadd_);
1067 net.push_back(convolution_forward(conv_prim_desc));
1068 net_args.push_back({{DNNL_ARG_SRC, src->GetOpMem()},
1069 {DNNL_ARG_WEIGHTS, filter->GetOpMem()},
1070 {DNNL_ARG_BIAS, bias->GetOpMem()},
1071 { DNNL_ARG_DST,
1072 output->GetOpMem() }});
1073 } else {
1074 DCHECK(!fuse_biasadd_);
1075 net.push_back(convolution_forward(conv_prim_desc));
1076 net_args.push_back({{DNNL_ARG_SRC, src->GetOpMem()},
1077 {DNNL_ARG_WEIGHTS, filter->GetOpMem()},
1078 { DNNL_ARG_DST,
1079 output->GetOpMem() }});
1080 }
1081 ExecutePrimitive(net, &net_args, cpu_engine_);
1082 }
1083
1084 // LOCKS_EXCLUDED annotation ensures that the lock (mu_) cannot
1085 // be acquired before entering the function, since it is acquired

Callers

nothing calls this directly

Calls 4

ExecutePrimitiveFunction · 0.85
CheckReorderToOpMemMethod · 0.80
GetTensorBufferMethod · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected