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

Function IsCPUScalarTensor

oneflow/core/functional/impl/binary_functor.cpp:43–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41namespace {
42
43bool IsCPUScalarTensor(const std::shared_ptr<Tensor>& tensor) {
44 return tensor->shape()->NumAxes() == 0
45 && TensorDeviceToString(tensor).find("cpu") != std::string::npos;
46}
47
48} // namespace
49

Callers 1

Calls 4

TensorDeviceToStringFunction · 0.85
findMethod · 0.80
NumAxesMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected