Tag: tensorflow

在C ++中重新解释Node.js fii的等价物

我试图在C ++中复制这个例子,我被困在读取数据的绝对最后一步。 exports.TF_ReadTensorData = function(tensor, size, type) { var ptr = libtensorflow.TF_TensorData(tensor); ptr = ptr.reinterpret(size, 0); ptr.type = type; return ptr.deref(); } 对于C ++,我已经完成了这一点。 #include <bits/stdc++.h> #include "tf_session_helper.h" #include "tf_session_helper.cc" #include "tf_tensor_helper.cc" #include "tensorflow/core/public/tensor_c_api.h" using namespace std; main() { TF_DataType::TF_UINT16; auto status = TF_NewStatus(); auto status_ops = TF_NewSessionOptions(); auto session = TF_NewSession(status_ops, status); std::ifstream in("graph.pb"); […]

Tensorflow服务grpc客户端错误12

我目前正在尝试通过张量服务服务一个简单的模型,然后我想通过使用node.js通过gRRC调用它。 我觉得学习/理解这个最简单的方法就是把它分解成最简单的模型。 请原谅这个命名,因为我最初是用一个Mnist教程开始做的,但是我也没有成功。 所以这个名字还是说mnist,但这只是一个简单的计算实现。 我使用下面的代码创build和导出模型: – 简单模型 – x = tf.placeholder(tf.float32, shape=(None)) y = tf.placeholder(tf.float32, shape=(None)) three = tf.Variable(3, dtype=tf.float32) z = tf.scalar_mul(three, x) + y – 出口 – model_version = 1 path = os.path.join("mnist_test", str(model_version)) builder = tf.python.saved_model.builder.SavedModelBuilder(path) with tf.Session() as sess: sess.run(tf.global_variables_initializer()) builder.add_meta_graph_and_variables( sess, [tf.python.saved_model.tag_constants.SERVING], signature_def_map = { "test_mnist_model": tf.saved_model.signature_def_utils.predict_signature_def( inputs={"xval": x, "yval":y}, […]