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

Function _convert_single_value_cpp

imperative/python/src/tensor_utils.cpp:448–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446}
447
448py::object _convert_single_value_cpp(
449 py::handle value, py::handle dtype, py::handle device) {
450 if (is_tensor(value)) {
451 if (_get_dtype(value).category() != DTypeCategory::QUANTIZED) {
452 return _astype_cpp(value, dtype);
453 }
454 } else {
455 return _Const(value, dtype, device);
456 }
457 return py::reinterpret_borrow<py::object>(value);
458}
459
460py::object _convert_inputs_cpp(
461 PyObject* const* args, size_t nargs, py::object dtype, py::object device) {

Callers 2

_convert_inputs_cppFunction · 0.85
tensor_utils.cppFile · 0.85

Calls 5

is_tensorFunction · 0.85
_get_dtypeFunction · 0.85
_astype_cppFunction · 0.85
_ConstFunction · 0.85
categoryMethod · 0.80

Tested by

no test coverage detected