Failing Model
Hey! I am using:
cppflow::model model("C:\\Users\\Caike\\source\\repos\\StarCon\\x64\\Debug\\Models\\Objects\\");
auto input = cppflow::decode_jpeg(cppflow::read_file(std::string("C:\\Users\\Caike\\source\\repos\\StarCon\\x64\\Debug\\output2.jpg")));
input = cppflow::cast(input, TF_UINT8, TF_FLOAT);
input = input / 255.f;
input = cppflow::expand_dims(input, 0);
auto output = model(input);
std::cout << cppflow::arg_max(output, 1) << std::endl;
Console Output:
2021-05-15 11:59:32.485500: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2021-05-15 11:59:32.617474: I tensorflow/cc/saved_model/reader.cc:32] Reading SavedModel from: C:\Users\Caike\source\repos\StarCon\x64\Debug\Models\Objects\
2021-05-15 11:59:33.149503: I tensorflow/cc/saved_model/reader.cc:55] Reading meta graph with tags { serve }
2021-05-15 11:59:33.151250: I tensorflow/cc/saved_model/reader.cc:93] Reading SavedModel debug info (if present) from: C:\Users\Caike\source\repos\StarCon\x64\Debug\Models\Objects\
2021-05-15 11:59:33.152349: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-05-15 11:59:33.157661: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library nvcuda.dll
2021-05-15 11:59:33.216964: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: NVIDIA GeForce GTX 1650 computeCapability: 7.5
coreClock: 1.71GHz coreCount: 14 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 119.24GiB/s
2021-05-15 11:59:33.217070: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2021-05-15 11:59:33.226504: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
2021-05-15 11:59:33.226597: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
2021-05-15 11:59:33.231091: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll
2021-05-15 11:59:33.233159: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll
2021-05-15 11:59:33.236864: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusolver64_10.dll
2021-05-15 11:59:33.241364: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusparse64_11.dll
2021-05-15 11:59:33.243447: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudnn64_8.dll
2021-05-15 11:59:33.243601: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-05-15 11:59:33.836740: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-05-15 11:59:33.838354: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267] 0
2021-05-15 11:59:33.838434: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0: N
2021-05-15 11:59:33.838945: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1406] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2907 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce GTX 1650, pci bus id: 0000:01:00.0, compute capability: 7.5)
2021-05-15 11:59:33.840347: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-05-15 11:59:35.854851: I tensorflow/cc/saved_model/loader.cc:206] Restoring SavedModel bundle.
2021-05-15 11:59:39.618308: I tensorflow/cc/saved_model/loader.cc:190] Running initialization op on SavedModel bundle at path: C:\Users\Caike\source\repos\StarCon\x64\Debug\Models\Objects\
2021-05-15 11:59:40.894311: I tensorflow/cc/saved_model/loader.cc:277] SavedModel load for tags { serve }; Status: success: OK. Took 8276835 microseconds.
2021-05-15 11:59:41.807638: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: NVIDIA GeForce GTX 1650 computeCapability: 7.5
coreClock: 1.71GHz coreCount: 14 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 119.24GiB/s
2021-05-15 11:59:41.807803: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2021-05-15 11:59:41.809126: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
2021-05-15 11:59:41.809492: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
2021-05-15 11:59:41.810833: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll
2021-05-15 11:59:41.811415: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll
2021-05-15 11:59:41.811750: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusolver64_10.dll
2021-05-15 11:59:41.812046: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusparse64_11.dll
2021-05-15 11:59:41.812395: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudnn64_8.dll
2021-05-15 11:59:41.812760: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-05-15 11:59:41.813013: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-05-15 11:59:41.813273: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267] 0
2021-05-15 11:59:41.813543: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0: N
2021-05-15 11:59:41.813919: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1406] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2907 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce GTX 1650, pci bus id: 0000:01:00.0, compute capability: 7.5)
2021-05-15 11:59:41.814120: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
It throws a error in model.h line 135
if (!inp_ops[i].oper)
throw std::runtime_error("No operation named \"" + op_name + "\" exists");
Been trying for some time now. Cppflow Successfully opens all dynamic libaries.
Already checked #66 Does not fix my issue
I managed to make it into a new error:
Expects arg[0] to be uint8 but float is provided
Ohh, I made it console log.
no operation named "serving_default_input_tensor" exists
Thats why
BUT
for (auto s : model.get_operations())
std::cout << s << std::endl;
serving_default_input_tensor is on the last lines. Hmm
center_net_hourglass_feature_extractor/hourglass_network/residual_block_69/batchnorm/moving_variance/Read/ReadVariableOp conv2d_161/kernel conv2d_161/kernel/Read/ReadVariableOp conv2d_161/bias conv2d_161/bias/Read/ReadVariableOp conv2d_160/kernel conv2d_160/kernel/Read/ReadVariableOp conv2d_160/bias conv2d_160/bias/Read/ReadVariableOp conv2d_163/kernel conv2d_163/kernel/Read/ReadVariableOp conv2d_163/bias conv2d_163/bias/Read/ReadVariableOp conv2d_162/kernel conv2d_162/kernel/Read/ReadVariableOp conv2d_162/bias conv2d_162/bias/Read/ReadVariableOp conv2d_165/kernel conv2d_165/kernel/Read/ReadVariableOp conv2d_165/bias conv2d_165/bias/Read/ReadVariableOp conv2d_164/kernel conv2d_164/kernel/Read/ReadVariableOp conv2d_164/bias conv2d_164/bias/Read/ReadVariableOp conv2d_167/kernel conv2d_167/kernel/Read/ReadVariableOp conv2d_167/bias conv2d_167/bias/Read/ReadVariableOp conv2d_166/kernel conv2d_166/kernel/Read/ReadVariableOp conv2d_166/bias conv2d_166/bias/Read/ReadVariableOp conv2d_169/kernel conv2d_169/kernel/Read/ReadVariableOp conv2d_169/bias conv2d_169/bias/Read/ReadVariableOp conv2d_168/kernel conv2d_168/kernel/Read/ReadVariableOp conv2d_168/bias conv2d_168/bias/Read/ReadVariableOp conv2d_171/kernel conv2d_171/kernel/Read/ReadVariableOp conv2d_171/bias conv2d_171/bias/Read/ReadVariableOp conv2d_170/kernel conv2d_170/kernel/Read/ReadVariableOp conv2d_170/bias conv2d_170/bias/Read/ReadVariableOp NoOp Const serving_default_input_tensor StatefulPartitionedCall saver_filename StatefulPartitionedCall_1 StatefulPartitionedCall_2
two errors: Expects arg[0] to be uint8 but float is provided No operation named "serving_default_input_tensor" exists
Hi @tewni-svg
If it's expecting a uint8 tensor then you shouldn't do a cast to float.
Hi @tewni-svg
If it's expecting a uint8 tensor then you shouldn't do a cast to float.
Hi. Thank you for your reply. I removed the FLOAT to UINT8. but still getting this error cannot compute Div as input #1(zero-based) was expected to be a uint8 tensor but is a float tensor
Hi @tewni-svg If it's expecting a uint8 tensor then you shouldn't do a cast to float.
Hi. Thank you for your reply. I removed the FLOAT to UINT8. but still getting this error cannot compute Div as input #1(zero-based) was expected to be a uint8 tensor but is a float tensor
{
cppflow::model model("C:\\Users\\Caike\\source\\repos\\StarCon\\x64\\Debug\\Models\\Objects\\");
for (auto s : model.get_operations())
std::cout << s << std::endl;
auto input = cppflow::decode_jpeg(cppflow::read_file(std::string("C:\\Users\\Caike\\source\\repos\\StarCon\\x64\\Debug\\output2.jpg")));
input = input / 255;
input = cppflow::expand_dims(input, 0);
//auto output = model(input);
auto output = model({ {"serving_default_input_tensor", input} }, { "StatefulPartitionedCall:0" });
std::cout << cppflow::arg_max(output, 1) << std::endl;
}
on console log: (tensor: shape=[720 960 3], dtype=TF_UINT8,
but error is still cannot compute Div as input #1(zero-based) was expected to be a uint8 tensor but is a int32 tensor
You should cast to the expected types before feeding the tensors to the model.
Closing due to lack of activity.