MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / FALCOR_SCRIPT_BINDING

Function FALCOR_SCRIPT_BINDING

Source/Falcor/Utils/Scripting/ndarray.cpp:896–923  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

894namespace Falcor
895{
896FALCOR_SCRIPT_BINDING(ndarray)
897{
898 m.def(
899 "inspect_ndarray",
900 [](pybind11::ndarray<> ndarray)
901 {
902 printf("ndarray data pointer : %p\n", ndarray.data());
903 printf("ndarray dimension : %zu\n", ndarray.ndim());
904 for (size_t i = 0; i < ndarray.ndim(); ++i)
905 {
906 printf("ndarray dimension [%zu] : %zu\n", i, ndarray.shape(i));
907 printf("ndarray stride [%zu] : %zd\n", i, ndarray.stride(i));
908 }
909 printf(
910 "Device ID = %u (cpu=%i, cuda=%i)\n",
911 ndarray.device_id(),
912 int(ndarray.device_type() == pybind11::device::cpu::value),
913 int(ndarray.device_type() == pybind11::device::cuda::value)
914 );
915 printf(
916 "ndarray dtype: int16=%i, uint32=%i, float32=%i\n",
917 ndarray.dtype() == pybind11::dtype<int16_t>(),
918 ndarray.dtype() == pybind11::dtype<uint32_t>(),
919 ndarray.dtype() == pybind11::dtype<float>()
920 );
921 }
922 );
923}
924
925} // namespace Falcor

Callers

nothing calls this directly

Calls 7

ndimMethod · 0.80
shapeMethod · 0.80
strideMethod · 0.80
device_idMethod · 0.80
device_typeMethod · 0.80
dtypeMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected