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

Function get_default_cpu_allocator

tensorflow/core/framework/tensor.cc:850–854  ·  view source on GitHub ↗

NOTE(mrry): The default allocator for a Tensor (when none is specified) is the default CPU allocator for NUMA zone 0. Accessing that currently involves acquiring a lock, which guards initialization of the per-NUMA zone allocators, and becomes highly contended. Note also that it would be better if all Tensor allocations required the user to specify an allocator, for purposes of accounting, etc. Ho

Source from the content-addressed store, hash-verified

848// to specify an allocator, for purposes of accounting, etc. However, the
849// default allocator is widely used throughout the codebase and in client code.
850static Allocator* get_default_cpu_allocator() {
851 static Allocator* default_cpu_allocator =
852 cpu_allocator(port::kNUMANoAffinity);
853 return default_cpu_allocator;
854}
855
856Tensor::Tensor(DataType type, const TensorShape& shape)
857 : Tensor(get_default_cpu_allocator(), type, shape) {}

Callers 2

TensorMethod · 0.85
FromProtoMethod · 0.85

Calls 1

cpu_allocatorFunction · 0.85

Tested by

no test coverage detected