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

Class handles

tensorflow/core/kernels/xsmm_conv2d.cc:135–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133};
134
135class handles {
136 public:
137 libxsmm_dnn_layer* find(const libxsmm_dnn_conv_desc_wrap& w) {
138 std::unordered_map<libxsmm_dnn_conv_desc_wrap, libxsmm_dnn_layer*,
139 HashFunction>::iterator i = libxsmm_handles.find(w);
140 if (i == libxsmm_handles.end()) {
141 libxsmm_dnn_err_t status;
142 libxsmm_dnn_layer* libxsmm_handle =
143 libxsmm_dnn_create_conv_layer(w.d, &status);
144 chk_libxsmm_err(status, "Create handle");
145 libxsmm_handles.insert(std::make_pair(w, libxsmm_handle));
146 return libxsmm_handle;
147 } else {
148 return i->second;
149 }
150 }
151 ~handles() {
152 std::unordered_map<libxsmm_dnn_conv_desc_wrap, libxsmm_dnn_layer*,
153 HashFunction>::iterator i;
154 for (i = libxsmm_handles.begin(); i != libxsmm_handles.end(); i++)
155 chk_libxsmm_err(libxsmm_dnn_destroy_conv_layer(i->second),
156 "Destroy handle");
157 }
158
159 private:
160 std::unordered_map<libxsmm_dnn_conv_desc_wrap, libxsmm_dnn_layer*,
161 HashFunction>
162 libxsmm_handles;
163};
164
165static handles libxsmm_handles;
166

Callers 3

ComputeMethod · 0.85
ComputeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected