MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / get_workspace_bundle

Method get_workspace_bundle

dnn/src/naive/pooling/opr_impl.cpp:380–396  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

378namespace naive {
379
380WorkspaceBundle PoolingForwardImpl::get_workspace_bundle(
381 void* ptr, const TensorLayout& src, const TensorLayout& dst) const {
382 SmallVector<size_t> sizes;
383 TensorLayout fsrc = src;
384 TensorLayout fdst = dst;
385 auto get_workspace = [&sizes](TensorLayout& layout) {
386 if (layout.dtype.enumv() == DTypeEnum::Quantized4Asymm ||
387 layout.dtype.enumv() == DTypeEnum::QuantizedS4) {
388 layout.dtype = dtype::Int8();
389 layout.format = TensorLayout::Format(layout.dtype);
390 sizes.push_back(layout.span().dist_byte());
391 }
392 };
393 get_workspace(fsrc);
394 get_workspace(fdst);
395 return {ptr, std::move(sizes)};
396};
397
398size_t PoolingForwardImpl::get_workspace_in_bytes(
399 const TensorLayout& src, const TensorLayout& dst) {

Callers

nothing calls this directly

Calls 6

dist_byteMethod · 0.80
spanMethod · 0.80
FormatClass · 0.50
get_workspaceFunction · 0.50
enumvMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected