MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / UpdateCacheKey

Method UpdateCacheKey

oneflow/core/framework/op_kernel_infer_cache.cpp:46–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46void OpKernelInferCache::UpdateCacheKey(KernelInferContext* ctx) {
47 auto GetSymbolOfShape = [&](const std::string& arg_name, int32_t arg_index) -> Symbol<Shape> {
48 Shape shape;
49 ctx->ShapeView4ArgNameAndIndex(arg_name, arg_index).ToShape(&shape);
50 return SymbolOf(shape);
51 };
52 const auto& inputs = ctx->inputs();
53 FOR_RANGE(int, i, 0, inputs.size()) {
54 const auto& arg_pair = inputs.at(i);
55 cache_key_.ibn_idx2shape_sym.at(i) = GetSymbolOfShape(arg_pair.first, arg_pair.second);
56 }
57}
58
59void OpKernelInferCache::UpdateCacheValue(KernelInferContext* ctx) {
60 // TODO: make max size configurable

Callers 1

ForwardShapeMethod · 0.80

Calls 3

SymbolOfFunction · 0.85
ToShapeMethod · 0.45

Tested by

no test coverage detected