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

Function pyfloat2hval

imperative/python/src/tensor.cpp:357–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355}
356
357bool pyfloat2hval(py::float_ obj, CompNode cn, DType dtype, HostTensorArgs& ret) {
358 if (!dtype.valid()) {
359 dtype = dtype::Float32();
360 }
361 ret.dtype = dtype;
362 ret.storage = scalar2storage((dt_float32)obj, cn, dtype);
363 return true;
364}
365
366HostTensorArgs pyobj2hval(py::object obj, CompNode cn, DType dtype) {
367 HostTensorArgs ret;

Callers 1

pyobj2hvalFunction · 0.85

Calls 2

scalar2storageFunction · 0.85
validMethod · 0.45

Tested by

no test coverage detected