replace onnx:: with ONNX_NAMESPACE:: (#1376)

* replace onnx:: with ONNX_NAMESPACE::

* Fixed issue for building shared libs

* address CR feedback

* address more CR feedback
This commit is contained in:
Yang Chen 2019-07-15 01:06:53 -07:00 committed by GitHub
parent 61b733ce6d
commit fa4b956f12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 5 additions and 7 deletions

View file

@ -538,7 +538,7 @@ TensorProto::DataType GetTensorProtoType(const Tensor& tensor) {
}
ONNX_NAMESPACE::TensorProto TensorToTensorProto(const Tensor& tensor, const std::string& tensor_proto_name,
const onnx::TypeProto& tensor_proto_type) {
const ONNX_NAMESPACE::TypeProto& tensor_proto_type) {
// Given we are using the raw_data field in the protobuf, this will work only for little-endian format.
ORT_ENFORCE(IsLittleEndianOrder());

View file

@ -47,7 +47,7 @@ ONNX_NAMESPACE::TensorProto::DataType GetTensorProtoType(const Tensor& tensor);
TODO Once the GetTensorProtoType supports all data types, we can remove the tensor_proto_type parameter and
instead get the type from the tensor. */
ONNX_NAMESPACE::TensorProto TensorToTensorProto(const Tensor& tensor, const std::string& tensor_proto_name,
const onnx::TypeProto& tensor_proto_type);
const ONNX_NAMESPACE::TypeProto& tensor_proto_type);
ONNXTensorElementDataType CApiElementTypeFromProtoType(int type);
ONNXTensorElementDataType GetTensorElementType(const ONNX_NAMESPACE::TensorProto& tensor_proto);

View file

@ -398,7 +398,7 @@ const ONNX_NAMESPACE::TensorProto* GetConstantInitializer(const Graph& graph, co
}
bool IsConstantInitializer(const Graph& graph, const std::string& initializer_name, bool check_outer_scope) {
const onnx::TensorProto* initializer = GetConstantInitializer(graph, initializer_name, check_outer_scope);
const ONNX_NAMESPACE::TensorProto* initializer = GetConstantInitializer(graph, initializer_name, check_outer_scope);
return initializer != nullptr;
}

View file

@ -20,8 +20,6 @@
using namespace std;
using namespace ONNX_NAMESPACE;
using namespace onnx;
namespace onnxruntime {
namespace test {
@ -48,7 +46,7 @@ TEST(OptimizerTest, Basic) {
initializer_tensor[i].set_name(inputs[i]->Name());
initializer_tensor[i].add_dims(tensor_dim);
initializer_tensor[i].set_data_type(onnx::TensorProto_DataType_INT32);
initializer_tensor[i].set_data_type(ONNX_NAMESPACE::TensorProto_DataType_INT32);
for (int j = 0; j < tensor_dim; j++) {
initializer_tensor[i].add_int32_data((i + 1) * j);
}

View file

@ -31,7 +31,7 @@ TEST(MemcpyTest, copy1) {
KernelRegistryManager kernel_registry_manager;
kernel_registry_manager.RegisterKernels(execution_providers);
onnx::ModelProto mp;
ONNX_NAMESPACE::ModelProto mp;
std::ifstream model_istream("testdata/matmul_1.onnx", std::ifstream::in | std::ifstream::binary);
google::protobuf::io::IstreamInputStream zero_copy_input(&model_istream);
const bool result = mp.ParseFromZeroCopyStream(&zero_copy_input) && model_istream.eof();