From 3d7102e0bdae53c1deb22c12e5fc5ef987812b12 Mon Sep 17 00:00:00 2001 From: superjom Date: Sat, 6 Jan 2018 11:47:46 +0800 Subject: [PATCH 01/23] change paths --- server/visualdl/graph_test.sh | 12 - server/visualdl/mock.sh | 6 - server/visualdl/mock/README.md | 8 - server/visualdl/mock/__init__.py | 0 server/visualdl/mock/data.py | 101 ----- server/visualdl/mock/download_mock_models.sh | 20 - server/visualdl/mock/tags.py | 15 - server/visualdl/onnx/READEME.md | 2 - server/visualdl/onnx/__init__.py | 43 -- server/visualdl/onnx/onnx.proto | 420 ------------------ .../visualdl => visualdl/server}/__init__.py | 0 {server => visualdl/server}/build.sh | 0 {server/visualdl => visualdl/server}/graph.py | 0 .../server}/graph_test.py | 0 {server/visualdl => visualdl/server}/lib.py | 0 .../visualdl => visualdl/server}/lib_test.py | 0 {server/visualdl => visualdl/server}/log.py | 0 {server => visualdl/server}/setup.py | 0 .../server}/storage_mock.py | 0 .../server/visualdl.py | 12 +- 20 files changed, 7 insertions(+), 632 deletions(-) delete mode 100644 server/visualdl/graph_test.sh delete mode 100644 server/visualdl/mock.sh delete mode 100644 server/visualdl/mock/README.md delete mode 100644 server/visualdl/mock/__init__.py delete mode 100644 server/visualdl/mock/data.py delete mode 100644 server/visualdl/mock/download_mock_models.sh delete mode 100644 server/visualdl/mock/tags.py delete mode 100644 server/visualdl/onnx/READEME.md delete mode 100644 server/visualdl/onnx/__init__.py delete mode 100644 server/visualdl/onnx/onnx.proto rename {server/visualdl => visualdl/server}/__init__.py (100%) rename {server => visualdl/server}/build.sh (100%) rename {server/visualdl => visualdl/server}/graph.py (100%) rename {server/visualdl => visualdl/server}/graph_test.py (100%) rename {server/visualdl => visualdl/server}/lib.py (100%) rename {server/visualdl => visualdl/server}/lib_test.py (100%) rename {server/visualdl => visualdl/server}/log.py (100%) rename {server => visualdl/server}/setup.py (100%) rename {server/visualdl => visualdl/server}/storage_mock.py (100%) rename server/visualdl/visual_dl.py => visualdl/server/visualdl.py (96%) diff --git a/server/visualdl/graph_test.sh b/server/visualdl/graph_test.sh deleted file mode 100644 index b8d4ea650..000000000 --- a/server/visualdl/graph_test.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -ex - -cd mock -bash download_mock_models.sh - -cd .. - -python graph_test.py - -rm ./mock/*.pb - diff --git a/server/visualdl/mock.sh b/server/visualdl/mock.sh deleted file mode 100644 index 3578a3d1b..000000000 --- a/server/visualdl/mock.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -set -ex - -export PYTHONPATH="/home/superjom/project/VisualDL/build/visualdl/logic:/home/superjom/project/VisualDL/visualdl/python" - -python lib_test.py -v diff --git a/server/visualdl/mock/README.md b/server/visualdl/mock/README.md deleted file mode 100644 index 559883d16..000000000 --- a/server/visualdl/mock/README.md +++ /dev/null @@ -1,8 +0,0 @@ -## Note -Test data squeezenet and inception_v1 are from onnx/models. - -https://github.com/onnx/models - -squeezenet has 53 inputs, 66 nodes and 1 output. - -inception_v1 has 117 inputs, 143 nodes and 1 output. \ No newline at end of file diff --git a/server/visualdl/mock/__init__.py b/server/visualdl/mock/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/server/visualdl/mock/data.py b/server/visualdl/mock/data.py deleted file mode 100644 index bca178f47..000000000 --- a/server/visualdl/mock/data.py +++ /dev/null @@ -1,101 +0,0 @@ -def sequence_data(): - return [[1465980660.726887, 1, 0.07000000029802322], - [1465980660.767164, 2, 0.18000000715255737], - [1465980660.799817, 3, 0.3199999928474426], - [1465980660.831853, 4, 0.33000001311302185], - [1465980660.86555, 5, 0.3400000035762787], - [1465980660.898716, 6, 0.6000000238418579], - [1465980660.930804, 7, 0.6299999952316284], - [1465980660.963156, 8, 0.6299999952316284], - [1465980660.995727, 9, 0.6299999952316284], - [1465980661.603699, 11, 0.75], - [1465980661.641232, 12, 0.7900000214576721], - [1465980661.674311, 13, 0.7099999785423279], - [1465980661.704281, 14, 0.7099999785423279], - [1465980661.737259, 15, 0.7200000286102295], - [1465980661.768047, 16, 0.75], - [1465980661.801236, 17, 0.8600000143051147], - [1465980661.832749, 18, 0.7799999713897705], - [1465980661.862822, 19, 0.8399999737739563], - [1465980662.481258, 21, 0.699999988079071], - [1465980662.521448, 22, 0.6700000166893005], - [1465980662.557197, 23, 0.7699999809265137], - [1465980662.593898, 24, 0.7900000214576721], - [1465980662.629991, 25, 0.7200000286102295], - [1465980662.671198, 26, 0.8100000023841858], - [1465980662.711186, 27, 0.7599999904632568], - [1465980662.750267, 28, 0.7799999713897705], - [1465980662.791909, 29, 0.8299999833106995], - [1465980663.47027, 31, 0.8100000023841858], - [1465980663.538732, 32, 0.8500000238418579], - [1465980663.57077, 33, 0.8600000143051147], - [1465980663.60126, 34, 0.8199999928474426], - [1465980663.631059, 35, 0.7900000214576721], - [1465980663.665972, 36, 0.7799999713897705], - [1465980663.697275, 37, 0.9100000262260437], - [1465980663.726395, 38, 0.8700000047683716], - [1465980663.760169, 39, 0.9200000166893005], - [1465980664.45205, 41, 0.8299999833106995], - [1465980664.484207, 42, 0.7599999904632568], - [1465980664.515375, 43, 0.7699999809265137], - [1465980664.547608, 44, 0.8299999833106995], - [1465980664.580122, 45, 0.949999988079071], - [1465980664.611019, 46, 0.8999999761581421], - [1465980664.642956, 47, 0.8700000047683716], - [1465980664.674636, 48, 0.8500000238418579], - [1465980664.705622, 49, 0.8899999856948853], - [1465980665.379549, 51, 0.8399999737739563], - [1465980665.422869, 52, 0.8500000238418579], - [1465980665.466136, 53, 0.8199999928474426], - [1465980665.508361, 54, 0.9300000071525574], - [1465980665.544331, 55, 0.9399999976158142], - [1465980665.589887, 56, 0.8700000047683716], - [1465980665.633466, 57, 0.9300000071525574], - [1465980665.674978, 58, 0.7799999713897705], - [1465980665.716878, 59, 0.9300000071525574], - [1465980666.653456, 61, 0.8799999952316284], - [1465980666.697294, 62, 0.9300000071525574], - [1465980666.742066, 63, 0.8700000047683716], - [1465980666.780127, 64, 0.8299999833106995], - [1465980666.818287, 65, 0.9200000166893005], - [1465980666.855386, 66, 0.9399999976158142], - [1465980666.897352, 67, 0.9300000071525574], - [1465980666.931322, 68, 0.8899999856948853], - [1465980666.96562, 69, 0.8600000143051147], - [1465980667.619625, 71, 0.8700000047683716], - [1465980667.655166, 72, 0.9200000166893005], [ - 1465980667.687101, 73, 0.8199999928474426 - ], [1465980667.720176, 74, 0.8100000023841858], - [1465980667.751985, 75, 0.8500000238418579], [ - 1465980667.785244, 76, 0.8600000143051147 - ], [1465980667.820445, 77, 0.9200000166893005], [ - 1465980667.857163, 78, 0.8899999856948853 - ], [1465980667.891868, 79, 0.8999999761581421], [ - 1465980668.56409, 81, 0.8500000238418579 - ], [1465980668.599529, 82, 0.8299999833106995], [ - 1465980668.630751, 83, 0.8500000238418579 - ], [1465980668.665135, 84, 0.8199999928474426], [ - 1465980668.697928, 85, 0.8199999928474426 - ], [1465980668.730525, 86, 0.8799999952316284], [ - 1465980668.769772, 87, 0.9200000166893005 - ], [1465980668.803344, 88, 0.8299999833106995], [ - 1465980668.834414, 89, 0.800000011920929 - ], [1465980669.814826, 91, 0.8600000143051147], [ - 1465980669.851511, 92, 0.8899999856948853 - ], [1465980669.891407, 93, 0.8799999952316284], [ - 1465980669.927507, 94, 0.9399999976158142 - ], [1465980669.968384, 95, 0.9300000071525574], [ - 1465980670.007071, 96, 0.8500000238418579 - ], [1465980670.044314, 97, 0.8500000238418579], [ - 1465980670.083472, 98, 0.9100000262260437 - ], [1465980670.214597, 99, 0.8600000143051147], [ - 1465980670.934513, 101, 0.8799999952316284 - ], [1465980670.971317, 102, 0.8700000047683716], [ - 1465980671.003626, 103, 0.8600000143051147 - ], [1465980671.037037, 104, 0.8399999737739563], [ - 1465980671.070037, 105, 0.9200000166893005 - ], [1465980671.104992, 106, 0.8600000143051147], [ - 1465980671.137882, 107, 0.8100000023841858 - ], [1465980671.173917, 108, 0.7400000095367432], [ - 1465980671.205898, 109, 0.8799999952316284 - ], [1465980671.833723, 111, 0.9100000262260437]] diff --git a/server/visualdl/mock/download_mock_models.sh b/server/visualdl/mock/download_mock_models.sh deleted file mode 100644 index 69b2d0506..000000000 --- a/server/visualdl/mock/download_mock_models.sh +++ /dev/null @@ -1,20 +0,0 @@ - -# Download inception_v1 model -curl -LOk http://visualdl.bj.bcebos.com/inception_v1.tar.gz -#curl -LOk https://www.dropbox.com/s/twbfdqgvowzy762/inception_v1.tar.gz?dl=0 -tar -xvzf inception_v1.tar.gz -cp inception_v1/model.pb inception_v1_model.pb - -rm -rf inception_v1 -rm inception_v1.tar.gz - - -# Download squeezenet model -curl -LOk http://visualdl.bj.bcebos.com/squeezenet.tar.gz -#curl -LOk https://www.dropbox.com/s/fip3jzxsjf2g6zc/squeezenet.tar.gz?dl=0 -tar -xvzf squeezenet.tar.gz -cp squeezenet/model.pb squeezenet_model.pb - -rm -rf squeezenet -rm squeezenet.tar.gz - diff --git a/server/visualdl/mock/tags.py b/server/visualdl/mock/tags.py deleted file mode 100644 index f37de69c1..000000000 --- a/server/visualdl/mock/tags.py +++ /dev/null @@ -1,15 +0,0 @@ -def data(): - return { - "test": { - "min/layer2/weights": { - "displayName": "min/layer2/weights", - "description": "" - } - }, - "train": { - "min/layer2/weights": { - "displayName": "min/layer2/weights", - "description": "" - } - } - } diff --git a/server/visualdl/onnx/READEME.md b/server/visualdl/onnx/READEME.md deleted file mode 100644 index 22e926997..000000000 --- a/server/visualdl/onnx/READEME.md +++ /dev/null @@ -1,2 +0,0 @@ -## Note -the onnx.proto is port from onnx commit c3137751923f576d14b4212ea444d1562b127a66 diff --git a/server/visualdl/onnx/__init__.py b/server/visualdl/onnx/__init__.py deleted file mode 100644 index 0c77f8f6a..000000000 --- a/server/visualdl/onnx/__init__.py +++ /dev/null @@ -1,43 +0,0 @@ -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - -import google.protobuf.message - -from .onnx_pb2 import ModelProto - - -def load(obj): - ''' - Loads a binary protobuf that stores onnx model - - @params - Takes a file-like object (has "read" function) - or a string containing a file name - @return ONNX ModelProto object - ''' - if hasattr(obj, 'read') and callable(obj.read): - s = obj.read() - else: - with open(obj, 'rb') as f: - s = f.read() - return load_from_string(s) - - -def load_from_string(s): - ''' - Loads a binary string that stores onnx model - - @params - Takes a string object containing protobuf - @return ONNX ModelProto object - ''' - model = ModelProto() - decoded = model.ParseFromString(s) - # in python implementation ParseFromString returns None - if decoded is not None and decoded != len(s): - raise google.protobuf.message.DecodeError( - "Protobuf decoding consumed too few bytes: {} out of {}".format( - decoded, len(s))) - return model diff --git a/server/visualdl/onnx/onnx.proto b/server/visualdl/onnx/onnx.proto deleted file mode 100644 index 3a8bb9b66..000000000 --- a/server/visualdl/onnx/onnx.proto +++ /dev/null @@ -1,420 +0,0 @@ -// -// WARNING: This file is automatically generated! Please edit onnx.in.proto. -// - - -// Copyright (c) Facebook Inc. and Microsoft Corporation. -// Licensed under the MIT license. - -syntax = "proto2"; - -package onnx; - -// Note [Release] -// We are still in the very early stage of defining ONNX. The current -// version of ONNX is a starting point. While we are actively working -// towards a complete spec, we would like to get the community involved -// by sharing our working version of ONNX. - -// Note [Protobuf compatibility] -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Based on experience working with downstream vendors, we generally can't -// assume recent versions of protobufs. This means that we do not use any -// protobuf features that are only available in proto3. -// -// Here are the most notable contortions we have to carry out to work around -// these limitations: -// -// - No 'map' (added protobuf 3.0). We instead represent mappings as lists -// of key-value pairs, where order does not matter and duplicates -// are not allowed. - -// Note [Namespaces] -// ~~~~~~~~~~~~~~~~~ -// ONNX gives explicit names to graphs, intermediate values and -// serialized tensors. To make it easier to generate names, we organize -// these into separate namespaces (so, e.g., a graph can have the same -// name as a serialized tensor.) The namespaces are as follows: -// -// - Node: These names identify specific nodes in the graph (but not, necessarily -// any particular input or output of the node. -// - Graph: These names identify graphs in the protobuf. -// - Attribute: These names identify attribute names for extra attributes that -// are passed to operators. -// - Operator: These names identify particular operators. -// - Value: These names identify intermediate values (typically tensors) flowing through -// the computation of a graph. -// - Shape: These names represent parameters for unknown shape dimensions. -// -// We specify the namespace of a name in ONNX as comments in the form -// of "namespace {Node,Graph,Operator,Attribute,Value,Shape}". Framework is responsible -// for supporting the namespaces. -// -// Naming things is hard. Every element with a name has an optional doc_string associated -// with it, providing a human-readable description in text markdown. - -// To be compatible with both proto2 and proto3, we will use a version number -// that is not defined by the default value but an explicit enum number. -enum Version { - // proto3 requires the first enum value to be zero. - // We add this just to appease the compiler. - _START_VERSION = 0; - // The version field is always serialized and we will use it to store the - // version that the graph is generated from. This helps us set up version - // control. We should use version as - // xx(major) - xx(minor) - xxxx(bugfix) - // and we are starting with 0x00000001 (0.0.1), which was the - // version we published on Oct 10, 2017. - IR_VERSION_2017_10_10 = 0x00000001; - - // IR_VERSION 0.0.2 published on Oct 30, 2017 - // - Added type discriminator to AttributeProto to support proto3 users - IR_VERSION_2017_10_30 = 0x00000002; - - // IR VERSION 0.0.3 published on Nov 3, 2017 - // - For operator versioning: - // - Added new message OperatorSetIdProto - // - Added opset_import in ModelProto - // - For vendor extensions, added domain in NodeProto - IR_VERSION = 0x00000003; -} - -// A named attribute containing either singular float, integer, string -// and tensor values, or repeated float, integer, string and tensor values. -// An AttributeProto MUST contain the name field, and *only one* of the -// following content fields, effectively enforcing a C/C++ union equivalent. -message AttributeProto { - - // Note: this enum is structurally identical to the OpSchema::AttrType - // enum defined in schema.h. If you rev one, you likely need to rev the other. - enum AttributeType { - UNDEFINED = 0; - FLOAT = 1; - INT = 2; - STRING = 3; - TENSOR = 4; - GRAPH = 5; - - FLOATS = 6; - INTS = 7; - STRINGS = 8; - TENSORS = 9; - GRAPHS = 10; - } - - // The name field MUST be present for this version of the IR. - optional string name = 1; // namespace Attribute - - // A human-readable documentation for this attribute. Markdown is allowed. - optional string doc_string = 13; - - // The type field MUST be present for this version of the IR. - // For 0.0.1 versions of the IR, this field was not defined, and - // implementations needed to use has_field hueristics to determine - // which value field was in use. For IR_VERSION 0.0.2 or later, this - // field MUST be set and match the f|i|s|t|... field in use. This - // change was made to accomodate proto3 implementations. - optional AttributeType type = 20; // discriminator that indicates which field below is in use - - // Exactly ONE of the following fields must be present for this version of the IR - optional float f = 2; // float - optional int64 i = 3; // int - optional bytes s = 4; // UTF-8 string - optional TensorProto t = 5; // tensor value - optional GraphProto g = 6; // graph - // Do not use field below, it's deprecated. - // optional ValueProto v = 12; // value - subsumes everything but graph - - repeated float floats = 7; // list of floats - repeated int64 ints = 8; // list of ints - repeated bytes strings = 9; // list of UTF-8 strings - repeated TensorProto tensors = 10; // list of tensors - repeated GraphProto graphs = 11; // list of graph -} - -// Defines information on value, including the name, the type, and -// the shape of the value. -message ValueInfoProto { - // This field MUST be present in this version of the IR. - optional string name = 1; // namespace Value - // This field MUST be present in this version of the IR. - optional TypeProto type = 2; - // A human-readable documentation for this value. Markdown is allowed. - optional string doc_string = 3; -} - -// NodeProto stores a node that is similar to the notion of "layer" -// or "operator" in many deep learning frameworks. For example, it can be a -// node of type "Conv" that takes in an image, a filter tensor and a bias -// tensor, and produces the convolved output. -message NodeProto { - repeated string input = 1; // namespace Value - repeated string output = 2; // namespace Value - - // An optional identifier for this node in a graph. - // This field MAY be absent in ths version of the IR. - optional string name = 3; // namespace Node - - // The symbolic identifier of the Operator to execute. - optional string op_type = 4; // namespace Operator - // The domain of the OperatorSet that specifies the operator named by op_type. - optional string domain = 7; // namespace Domain - - // Additional named attributes. - // NOTE: Simply using ValueProto.NameValuePairProto is the most general - // solution. I kept AttributeProto to minimize churn on CI results. - repeated AttributeProto attribute = 5; - - // A human-readable documentation for this node. Markdown is allowed. - optional string doc_string = 6; -} - -// ModelProto is a top-level file/container format for bundling a ML model. -// The semantics of the model are described by the GraphProto that represents -// a parameterized computation graph against a set of named operators that are -// defined independently from the graph. -message ModelProto { - // The version of the IR this model targets. See Version enum above. - // This field MUST be present. - optional int64 ir_version = 1; - - // The OperatorSets this model relies on. - // All ModelProtos MUST have at least one entry that - // specifies which version of the ONNX OperatorSet is - // being imported. - // - // All nodes in the ModelProto's graph will bind against the operator - // with the same-domain/same-op_type operator with the HIGHEST version - // in the referenced operator sets. - repeated OperatorSetIdProto opset_import = 8; - - // The name of the framework or tool used to generate this model. - // This field SHOULD be present to indicate which implementation/tool/framework - // emitted the model. - optional string producer_name = 2; - - // The version of the framework or tool used to generate this model. - // This field SHOULD be present to indicate which implementation/tool/framework - // emitted the model. - optional string producer_version = 3; - - // Domain name of the model. - // We use reverse domain names as name space indicators. For example: - // `com.facebook.fair` or `com.microsoft.cognitiveservices` - // - // Together with `model_version` and GraphProto.name, this forms the unique identity of - // the graph. - optional string domain = 4; - - // The version of the graph encoded. See Version enum below. - optional int64 model_version = 5; - - // A human-readable documentation for this model. Markdown is allowed. - optional string doc_string = 6; - - // The parameterized graph that is evaluated to execute the model. - optional GraphProto graph = 7; - - // Named metadata values; keys should be distinct. - repeated StringStringEntryProto metadata_props = 14; -}; - -// StringStringEntryProto follows the pattern for cross-proto-version maps. -// See https://developers.google.com/protocol-buffers/docs/proto3#maps -message StringStringEntryProto { - optional string key = 1; - optional string value= 2; -}; - -// GraphProto defines a parameterized series of nodes to form a directed acyclic graph. -// This is the equivalent of the "network" and "graph" in many deep learning -// frameworks. -message GraphProto { - // The nodes in the graph. - repeated NodeProto node = 1; - - // The name of the graph. - optional string name = 2; // namespace Graph - - // A list of named tensor values (constants), used to specify default - // values for some of the inputs of the graph. - // Each TensorProto entry must have a distinct name (within the list) that - // also appears in the input list. - // In an evaluation, the default value specified here is used if and only if - // user specifies no value for the corresponding input parameter. - // May be used to pass serialized parameters for networks. - repeated TensorProto initializer = 5; - - // A human-readable documentation for this graph. Markdown is allowed. - optional string doc_string = 10; - - // The inputs and outputs of the graph. - repeated ValueInfoProto input = 11; - repeated ValueInfoProto output = 12; - - // Information for the values in the graph. The ValueInfoProto.name's - // must be distinct. It is optional for a value to appear in value_info list. - repeated ValueInfoProto value_info = 13; - - // DO NOT USE the following fields, they were deprecated before - // repeated string input = 3; - // repeated string output = 4; - // optional int64 ir_version = 6; - // optional int64 producer_version = 7; - // optional string producer_tag = 8; - // optional string domain = 9; -} - -// A message defined to store a tensor in its serialized format. -message TensorProto { - enum DataType { - UNDEFINED = 0; - // Basic types. - FLOAT = 1; // float - UINT8 = 2; // uint8_t - INT8 = 3; // int8_t - UINT16 = 4; // uint16_t - INT16 = 5; // int16_t - INT32 = 6; // int32_t - INT64 = 7; // int64_t - STRING = 8; // string - BOOL = 9; // bool - - // Advanced types - FLOAT16 = 10; - DOUBLE = 11; - UINT32 = 12; - UINT64 = 13; - COMPLEX64 = 14; // complex with float32 real and imaginary components - COMPLEX128 = 15; // complex with float64 real and imaginary components - // Future extensions go here. - } - - // The shape of the tensor. - repeated int64 dims = 1; - - // The data type of the tensor. - optional DataType data_type = 2; - - // For very large tensors, we may want to store them in chunks, in which - // case the following fields will specify the segment that is stored in - // the current TensorProto. - message Segment { - optional int64 begin = 1; - optional int64 end = 2; - } - optional Segment segment = 3; - - // Tensor content must be in the row major order. - // - // Depending on the data_type field, exactly one of the fields below with - // name ending in _data is used to store the elements of the tensor. - - // For float and complex64 values - // Complex64 tensors are encoded as a single array of floats, - // with the real components appearing in odd numbered positions, - // and the corresponding imaginary component apparing in the - // subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] - // is encoded as [1.0, 2.0 ,3.0 ,4.0] - // When this field is present, the data_type field MUST be FLOAT or COMPLEX64. - repeated float float_data = 4 [packed = true]; - - // For int32, uint8, int8, uint16, int16, bool, and float16 values - // float16 values must be bit-wise converted to an uint16_t prior - // to writing to the buffer. - // When this field is present, the data_type field MUST be - // INT32, INT16, INT8, UINT16, INT8, BOOL, or FLOAT32 - repeated int32 int32_data = 5 [packed = true]; - - // For strings. - // Each element of string_data is a UTF-8 encoded Unicode - // string. No trailing null, no leading BOM. The protobuf "string" - // scalar type is not used to match ML community conventions. - // When this field is present, the data_type field MUST be STRING - repeated bytes string_data = 6; - - // For int64. - // When this field is present, the data_type field MUST be INT64 - repeated int64 int64_data = 7 [packed = true]; - - // Optionally, a name for the tensor. - optional string name = 8; // namespace Value - - // A human-readable documentation for this tensor. Markdown is allowed. - optional string doc_string = 12; - - // Serializations can either use one of the fields above, or use this - // raw bytes field. The only exception is the string case, where one is - // required to store the content in the repeated bytes string_data field. - // - // When this raw_data field is used to store tensor value, elements MUST - // be stored in as fixed-width, little-endian order. - // Floating-point data types MUST be stored in IEEE 754 format. - // Complex64 elements must be written as two consecutive FLOAT values, real component first. - // Complex128 elements must be written as two consecutive DOUBLE values, real component first. - // Boolean type MUST be written one byte per tensor element (00000001 for true, 00000000 for false). - // - // Note: the advantage of specific field rather than the raw_data field is - // that in some cases (e.g. int data), protobuf does a better packing via - // variable length storage, and may lead to smaller binary footprint. - // When this field is present, the data_type field MUST NOT be STRING or UNDEFINED - optional bytes raw_data = 9; - - // For double - // Complex64 tensors are encoded as a single array of doubles, - // with the real components appearing in odd numbered positions, - // and the corresponding imaginary component apparing in the - // subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] - // is encoded as [1.0, 2.0 ,3.0 ,4.0] - // When this field is present, the data_type field MUST be DOUBLE or COMPLEX128 - repeated double double_data = 10 [packed = true]; - - // For uint64 and uint32 values - // When this field is present, the data_type field MUST be - // UINT32 or UINT64 - repeated uint64 uint64_data = 11 [packed = true]; -} - -// Defines a tensor shape. A dimension can be either an integer value -// or a symbolic variable. A symbolic variable represents an unknown -// dimension. -message TensorShapeProto { - message Dimension { - oneof value { - int64 dim_value = 1; - string dim_param = 2; // namespace Shape - }; - }; - repeated Dimension dim = 1; -} - -// Define the types. -message TypeProto { - - message Tensor { - // This field MUST NOT have the value of UNDEFINED - // This field MUST be present for this version of the IR. - optional TensorProto.DataType elem_type = 1; - optional TensorShapeProto shape = 2; - } - - - oneof value { - // The type of a tensor. - Tensor tensor_type = 1; - - } -} - -// OperatorSets are uniquely identified by a (domain, opset_version) pair. -message OperatorSetIdProto { - // The domain of the operator set being identified. - // The empty string ("") or absence of this field implies the operator - // set that is defined as part of the ONNX specification. - // This field MUST be present in this version of the IR when referring to any other operator set. - optional string domain = 1; - - // The version of the operator set being identified. - // This field MUST be present in this version of the IR. - optional int64 version = 2; -} \ No newline at end of file diff --git a/server/visualdl/__init__.py b/visualdl/server/__init__.py similarity index 100% rename from server/visualdl/__init__.py rename to visualdl/server/__init__.py diff --git a/server/build.sh b/visualdl/server/build.sh similarity index 100% rename from server/build.sh rename to visualdl/server/build.sh diff --git a/server/visualdl/graph.py b/visualdl/server/graph.py similarity index 100% rename from server/visualdl/graph.py rename to visualdl/server/graph.py diff --git a/server/visualdl/graph_test.py b/visualdl/server/graph_test.py similarity index 100% rename from server/visualdl/graph_test.py rename to visualdl/server/graph_test.py diff --git a/server/visualdl/lib.py b/visualdl/server/lib.py similarity index 100% rename from server/visualdl/lib.py rename to visualdl/server/lib.py diff --git a/server/visualdl/lib_test.py b/visualdl/server/lib_test.py similarity index 100% rename from server/visualdl/lib_test.py rename to visualdl/server/lib_test.py diff --git a/server/visualdl/log.py b/visualdl/server/log.py similarity index 100% rename from server/visualdl/log.py rename to visualdl/server/log.py diff --git a/server/setup.py b/visualdl/server/setup.py similarity index 100% rename from server/setup.py rename to visualdl/server/setup.py diff --git a/server/visualdl/storage_mock.py b/visualdl/server/storage_mock.py similarity index 100% rename from server/visualdl/storage_mock.py rename to visualdl/server/storage_mock.py diff --git a/server/visualdl/visual_dl.py b/visualdl/server/visualdl.py similarity index 96% rename from server/visualdl/visual_dl.py rename to visualdl/server/visualdl.py index 9b6c68e71..5f7f1fbc1 100644 --- a/server/visualdl/visual_dl.py +++ b/visualdl/server/visualdl.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import + import json import os import re @@ -7,12 +9,12 @@ from flask import (Flask, Response, redirect, request, send_file, send_from_directory) -import graph -import lib +from . import graph +from . import lib import storage -import visualdl.mock.data as mock_data -import visualdl.mock.tags as mock_tags -from visualdl.log import logger +from .mock import data as mock_data +from .mock import tags as mock_tags +from .log import logger app = Flask(__name__, static_url_path="") # set static expires in a short time to reduce browser's memory usage. From 680836673faed2e0a900ad05cd33c1d23a7c3b77 Mon Sep 17 00:00:00 2001 From: superjom Date: Sat, 6 Jan 2018 22:09:01 +0800 Subject: [PATCH 02/23] add setup --- VERSION_NUMBER | 1 + build.sh | 35 ++++++++++++++++++++++ setup.py | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 VERSION_NUMBER create mode 100644 build.sh create mode 100644 setup.py diff --git a/VERSION_NUMBER b/VERSION_NUMBER new file mode 100644 index 000000000..8a9ecc2ea --- /dev/null +++ b/VERSION_NUMBER @@ -0,0 +1 @@ +0.0.1 \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 000000000..77fc55fef --- /dev/null +++ b/build.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -ex + +TOP_DIR=$(pwd) +FRONTEND_DIR=$TOP_DIR/frontend +BACKEND_DIR=$TOP_DIR/visualdl +BUILD_DIR=$TOP_DIR/build + +mkdir -p $BUILD_DIR + +build_frontend() { + cd $FRONTEND_DIR + npm install + npm run build +} + +build_backend() { + cd $BUILD_DIR + cmake .. + make -j2 +} + +package() { + cd $BUILD_DIR + mkdir -p pip_package/visualdl + cd pip_package/visualdl + touch __init__.py + cp -rf $BACKEND_DIR/python/*.py . + cp -rf $BACKEND_DIR/server . + cp $BUILD_DIR/visualdl/logic/core.so . +} + +build_frontend +build_backend +package diff --git a/setup.py b/setup.py new file mode 100644 index 000000000..50135c703 --- /dev/null +++ b/setup.py @@ -0,0 +1,81 @@ +from __future__ import absolute_import + +import os +import sys +from distutils.spawn import find_executable +from distutils import sysconfig, dep_util, log +import setuptools.command.build_py +import setuptools +from setuptools import setup +import subprocess + +TOP_DIR = os.path.realpath(os.path.dirname(__file__)) +PYTHON_SDK_DIR = os.path.join(TOP_DIR, 'visualdl/python') +BUILD_DIR = os.path.join(TOP_DIR, 'build') + + +def read(name): + return open(os.path.join(TOP_DIR, name)).read() + + +def readlines(name): + return read(name).split('\n') + + +VERSION_NUMBER = open(os.path.join(TOP_DIR, 'VERSION_NUMBER')) +LICENSE = readlines('LICENSE')[0].strip() + +install_requires = ['Flask', 'numpy', 'Pillow', 'protobuf'] +execute_requires = ['npm', 'node', 'protoc', 'bash'] + + +def die(msg): + log.error(msg) + sys.exit(1) + + +def CHECK(cond, msg): + if not cond: + die(msg) + + +for exe in execute_requires: + CHECK(find_executable(exe), "{} should be installed.".format(exe)) + + +class BaseCommand(setuptools.Command): + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + +class build(BaseCommand): + def run(self): + subprocess.check_call(['bash', 'build.sh']) + + +class build_py(setuptools.command.build_py.build_py): + def run(self): + self.run_command('build') + return setuptools.command.build_py.build_py.run(self) + + +cmdclass = { + 'build': build, + 'build_py': build_py, +} + +setup( + name="VisualDL", + version=VERSION_NUMBER, + author="PaddlePaddle and Echarts team.", + description="Visualize Deep Learning.", + license=LICENSE, + keywords="visualization deeplearning", + long_description=read('README.md'), + install_requires=install_requires, + cmdclass=cmdclass) From 47f3f204b3d320e5ad0c7233c7143c80a1b35131 Mon Sep 17 00:00:00 2001 From: superjom Date: Sun, 7 Jan 2018 10:44:57 +0800 Subject: [PATCH 03/23] add packages --- build.sh | 6 +++--- setup.py | 20 +++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/build.sh b/build.sh index 77fc55fef..6e389a7a6 100644 --- a/build.sh +++ b/build.sh @@ -21,9 +21,9 @@ build_backend() { } package() { - cd $BUILD_DIR - mkdir -p pip_package/visualdl - cd pip_package/visualdl + cd $TOP_DIR + mkdir -p pip_package + cd pip_package touch __init__.py cp -rf $BACKEND_DIR/python/*.py . cp -rf $BACKEND_DIR/server . diff --git a/setup.py b/setup.py index 50135c703..7cf908f4e 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ def readlines(name): return read(name).split('\n') -VERSION_NUMBER = open(os.path.join(TOP_DIR, 'VERSION_NUMBER')) +VERSION_NUMBER = read('VERSION_NUMBER') LICENSE = readlines('LICENSE')[0].strip() install_requires = ['Flask', 'numpy', 'Pillow', 'protobuf'] @@ -53,24 +53,25 @@ def finalize_options(self): pass -class build(BaseCommand): - def run(self): - subprocess.check_call(['bash', 'build.sh']) - - class build_py(setuptools.command.build_py.build_py): def run(self): - self.run_command('build') + subprocess.check_call(['bash', 'build.sh']) return setuptools.command.build_py.build_py.run(self) cmdclass = { - 'build': build, 'build_py': build_py, } +packages = [ + 'pip_package', + 'pip_package.server', +] + +print 'packages', packages + setup( - name="VisualDL", + name="visualdl", version=VERSION_NUMBER, author="PaddlePaddle and Echarts team.", description="Visualize Deep Learning.", @@ -78,4 +79,5 @@ def run(self): keywords="visualization deeplearning", long_description=read('README.md'), install_requires=install_requires, + packages=packages, cmdclass=cmdclass) From a21478bcbd30d5048af852216da1780a9acf6e26 Mon Sep 17 00:00:00 2001 From: superjom Date: Sun, 7 Jan 2018 12:40:42 +0800 Subject: [PATCH 04/23] update --- build.sh | 7 +++++-- setup.py | 13 ++++++++----- visualdl/python/storage.py | 3 ++- visualdl/server/visualdl.py | 10 +++++----- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/build.sh b/build.sh index 6e389a7a6..c3a3d3ba3 100644 --- a/build.sh +++ b/build.sh @@ -22,14 +22,17 @@ build_backend() { package() { cd $TOP_DIR - mkdir -p pip_package + mkdir -p pip_package/visualdl cd pip_package touch __init__.py + cd visualdl + touch __init__.py + cp -rf $BACKEND_DIR/python/*.py . cp -rf $BACKEND_DIR/server . cp $BUILD_DIR/visualdl/logic/core.so . } -build_frontend +#build_frontend build_backend package diff --git a/setup.py b/setup.py index 7cf908f4e..5aedd803f 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ from distutils import sysconfig, dep_util, log import setuptools.command.build_py import setuptools -from setuptools import setup +from setuptools import setup, find_packages import subprocess TOP_DIR = os.path.realpath(os.path.dirname(__file__)) @@ -64,12 +64,9 @@ def run(self): } packages = [ - 'pip_package', - 'pip_package.server', + '', ] -print 'packages', packages - setup( name="visualdl", version=VERSION_NUMBER, @@ -79,5 +76,11 @@ def run(self): keywords="visualization deeplearning", long_description=read('README.md'), install_requires=install_requires, + package_data={'frontend.dist': ['*', 'fonts/*'], + 'visualdl':['core.so']}, packages=packages, + package_dir={'': 'pip_package/visualdl', + 'server': 'pip_package/visualdl/server'}, + scripts=['visualdl/server/visualdl.py'], + include_package_data=True, cmdclass=cmdclass) diff --git a/visualdl/python/storage.py b/visualdl/python/storage.py index c78b3b6c4..b18ff0ffe 100644 --- a/visualdl/python/storage.py +++ b/visualdl/python/storage.py @@ -2,7 +2,8 @@ 'StorageReader', 'StorageWriter', ] -import core + +import visualdl.core dtypes = ("float", "double", "int32", "int64") diff --git a/visualdl/server/visualdl.py b/visualdl/server/visualdl.py index 5f7f1fbc1..9ac661428 100644 --- a/visualdl/server/visualdl.py +++ b/visualdl/server/visualdl.py @@ -9,12 +9,12 @@ from flask import (Flask, Response, redirect, request, send_file, send_from_directory) -from . import graph -from . import lib +from visualdl import graph +from visualdl import lib import storage -from .mock import data as mock_data -from .mock import tags as mock_tags -from .log import logger +from visualdl.mock import data as mock_data +from visualdl.mock import tags as mock_tags +from visualdl.log import logger app = Flask(__name__, static_url_path="") # set static expires in a short time to reduce browser's memory usage. From 1a8589298cf82ab6d14cb6a0c0be5f3562cdc2b2 Mon Sep 17 00:00:00 2001 From: superjom Date: Sun, 7 Jan 2018 15:09:45 +0800 Subject: [PATCH 05/23] install ready --- build.sh | 25 +++++++++++++++---------- setup.py | 12 +++++++----- visualdl/__init__.py | 3 +++ visualdl/python/__init__.py | 1 - visualdl/python/storage.py | 7 ++----- 5 files changed, 27 insertions(+), 21 deletions(-) create mode 100644 visualdl/__init__.py diff --git a/build.sh b/build.sh index c3a3d3ba3..8b460367b 100644 --- a/build.sh +++ b/build.sh @@ -21,18 +21,23 @@ build_backend() { } package() { - cd $TOP_DIR - mkdir -p pip_package/visualdl - cd pip_package - touch __init__.py - cd visualdl - touch __init__.py - - cp -rf $BACKEND_DIR/python/*.py . - cp -rf $BACKEND_DIR/server . - cp $BUILD_DIR/visualdl/logic/core.so . + cp -rf $FRONTEND_DIR/dist $TOP_DIR/visualdl/server/ + cp $BUILD_DIR/visualdl/logic/core.so $TOP_DIR/visualdl } +# package() { +# cd $TOP_DIR +# mkdir -p pip_package/visualdl +# cd pip_package +# touch __init__.py +# cd visualdl +# touch __init__.py + +# cp -rf $BACKEND_DIR/python/*.py . +# cp -rf $BACKEND_DIR/server . +# cp $BUILD_DIR/visualdl/logic/core.so . +# } + #build_frontend build_backend package diff --git a/setup.py b/setup.py index 5aedd803f..070080f67 100644 --- a/setup.py +++ b/setup.py @@ -64,7 +64,9 @@ def run(self): } packages = [ - '', + 'visualdl', + 'visualdl.python', + 'visualdl.server', ] setup( @@ -76,11 +78,11 @@ def run(self): keywords="visualization deeplearning", long_description=read('README.md'), install_requires=install_requires, - package_data={'frontend.dist': ['*', 'fonts/*'], + package_data={'visualdl.server': ['dist/*', 'dist/fonts/*'], 'visualdl':['core.so']}, packages=packages, - package_dir={'': 'pip_package/visualdl', - 'server': 'pip_package/visualdl/server'}, + # package_dir={'pip_package': 'visualdl', + # 'frontend.dist': '../frontend/dist'}, scripts=['visualdl/server/visualdl.py'], - include_package_data=True, + # include_package_data=True, cmdclass=cmdclass) diff --git a/visualdl/__init__.py b/visualdl/__init__.py new file mode 100644 index 000000000..31b48f729 --- /dev/null +++ b/visualdl/__init__.py @@ -0,0 +1,3 @@ +from __future__ import absolute_import + +from .python.storage import * diff --git a/visualdl/python/__init__.py b/visualdl/python/__init__.py index 02d16cd1f..e69de29bb 100644 --- a/visualdl/python/__init__.py +++ b/visualdl/python/__init__.py @@ -1 +0,0 @@ -from storage import * diff --git a/visualdl/python/storage.py b/visualdl/python/storage.py index b18ff0ffe..f63754043 100644 --- a/visualdl/python/storage.py +++ b/visualdl/python/storage.py @@ -1,9 +1,6 @@ -__all__ = [ - 'StorageReader', - 'StorageWriter', -] +from __future__ import absolute_import -import visualdl.core +from .. import core dtypes = ("float", "double", "int32", "int64") From f5388b1fb26c2b84704a5556e86b05cf6635dfb6 Mon Sep 17 00:00:00 2001 From: superjom Date: Sun, 7 Jan 2018 15:19:11 +0800 Subject: [PATCH 06/23] restore mock --- visualdl/server/mock/README.md | 8 + visualdl/server/mock/__init__.py | 0 visualdl/server/mock/data.py | 228 ++++ visualdl/server/mock/download_mock_models.sh | 20 + visualdl/server/mock/tags.py | 15 + visualdl/server/onnx/READEME.md | 2 + visualdl/server/onnx/__init__.py | 43 + visualdl/server/onnx/onnx.proto | 420 +++++++ visualdl/server/onnx/onnx_pb2.py | 1098 ++++++++++++++++++ 9 files changed, 1834 insertions(+) create mode 100644 visualdl/server/mock/README.md create mode 100644 visualdl/server/mock/__init__.py create mode 100644 visualdl/server/mock/data.py create mode 100644 visualdl/server/mock/download_mock_models.sh create mode 100644 visualdl/server/mock/tags.py create mode 100644 visualdl/server/onnx/READEME.md create mode 100644 visualdl/server/onnx/__init__.py create mode 100644 visualdl/server/onnx/onnx.proto create mode 100644 visualdl/server/onnx/onnx_pb2.py diff --git a/visualdl/server/mock/README.md b/visualdl/server/mock/README.md new file mode 100644 index 000000000..559883d16 --- /dev/null +++ b/visualdl/server/mock/README.md @@ -0,0 +1,8 @@ +## Note +Test data squeezenet and inception_v1 are from onnx/models. + +https://github.com/onnx/models + +squeezenet has 53 inputs, 66 nodes and 1 output. + +inception_v1 has 117 inputs, 143 nodes and 1 output. \ No newline at end of file diff --git a/visualdl/server/mock/__init__.py b/visualdl/server/mock/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/visualdl/server/mock/data.py b/visualdl/server/mock/data.py new file mode 100644 index 000000000..35284d2b0 --- /dev/null +++ b/visualdl/server/mock/data.py @@ -0,0 +1,228 @@ +def sequence_data(): + return [[1465980660.726887, 1, 0.07000000029802322], + [1465980660.767164, 2, 0.18000000715255737], + [1465980660.799817, 3, 0.3199999928474426], + [1465980660.831853, 4, 0.33000001311302185], + [1465980660.86555, 5, 0.3400000035762787], + [1465980660.898716, 6, 0.6000000238418579], + [1465980660.930804, 7, 0.6299999952316284], + [1465980660.963156, 8, 0.6299999952316284], + [1465980660.995727, 9, 0.6299999952316284], + [1465980661.603699, 11, 0.75], + [1465980661.641232, 12, 0.7900000214576721], + [1465980661.674311, 13, 0.7099999785423279], + [1465980661.704281, 14, 0.7099999785423279], + [1465980661.737259, 15, 0.7200000286102295], + [1465980661.768047, 16, 0.75], + [1465980661.801236, 17, 0.8600000143051147], + [1465980661.832749, 18, 0.7799999713897705], + [1465980661.862822, 19, 0.8399999737739563], + [1465980662.481258, 21, 0.699999988079071], + [1465980662.521448, 22, 0.6700000166893005], + [1465980662.557197, 23, 0.7699999809265137], + [1465980662.593898, 24, 0.7900000214576721], + [1465980662.629991, 25, 0.7200000286102295], + [1465980662.671198, 26, 0.8100000023841858], + [1465980662.711186, 27, 0.7599999904632568], + [1465980662.750267, 28, 0.7799999713897705], + [1465980662.791909, 29, 0.8299999833106995], + [1465980663.47027, 31, 0.8100000023841858], + [1465980663.538732, 32, 0.8500000238418579], + [1465980663.57077, 33, 0.8600000143051147], + [1465980663.60126, 34, 0.8199999928474426], + [1465980663.631059, 35, 0.7900000214576721], + [1465980663.665972, 36, 0.7799999713897705], + [1465980663.697275, 37, 0.9100000262260437], + [1465980663.726395, 38, 0.8700000047683716], + [1465980663.760169, 39, 0.9200000166893005], + [1465980664.45205, 41, 0.8299999833106995], + [1465980664.484207, 42, 0.7599999904632568], + [1465980664.515375, 43, 0.7699999809265137], + [1465980664.547608, 44, 0.8299999833106995], + [1465980664.580122, 45, 0.949999988079071], + [1465980664.611019, 46, 0.8999999761581421], + [1465980664.642956, 47, 0.8700000047683716], + [1465980664.674636, 48, 0.8500000238418579], + [1465980664.705622, 49, 0.8899999856948853], + [1465980665.379549, 51, 0.8399999737739563], + [1465980665.422869, 52, 0.8500000238418579], + [1465980665.466136, 53, 0.8199999928474426], + [1465980665.508361, 54, 0.9300000071525574], + [1465980665.544331, 55, 0.9399999976158142], + [1465980665.589887, 56, 0.8700000047683716], + [1465980665.633466, 57, 0.9300000071525574], + [1465980665.674978, 58, 0.7799999713897705], + [1465980665.716878, 59, 0.9300000071525574], + [1465980666.653456, 61, 0.8799999952316284], + [1465980666.697294, 62, 0.9300000071525574], + [1465980666.742066, 63, 0.8700000047683716], + [1465980666.780127, 64, 0.8299999833106995], + [1465980666.818287, 65, 0.9200000166893005], + [1465980666.855386, 66, 0.9399999976158142], + [1465980666.897352, 67, 0.9300000071525574], + [1465980666.931322, 68, 0.8899999856948853], + [1465980666.96562, 69, 0.8600000143051147], + [1465980667.619625, 71, 0.8700000047683716], + [1465980667.655166, 72, 0.9200000166893005], [ + 1465980667.687101, 73, 0.8199999928474426 + ], [1465980667.720176, 74, 0.8100000023841858], + [1465980667.751985, 75, 0.8500000238418579], [ + 1465980667.785244, 76, 0.8600000143051147 + ], [1465980667.820445, 77, 0.9200000166893005], [ + 1465980667.857163, 78, 0.8899999856948853 + ], [1465980667.891868, 79, 0.8999999761581421], [ + 1465980668.56409, 81, 0.8500000238418579 + ], [1465980668.599529, 82, 0.8299999833106995], [ + 1465980668.630751, 83, 0.8500000238418579 + ], [1465980668.665135, 84, 0.8199999928474426], [ + 1465980668.697928, 85, 0.8199999928474426 + ], [1465980668.730525, 86, 0.8799999952316284], [ + 1465980668.769772, 87, 0.9200000166893005 + ], [1465980668.803344, 88, 0.8299999833106995], [ + 1465980668.834414, 89, 0.800000011920929 + ], [1465980669.814826, 91, 0.8600000143051147], [ + 1465980669.851511, 92, 0.8899999856948853 + ], [1465980669.891407, 93, 0.8799999952316284], [ + 1465980669.927507, 94, 0.9399999976158142 + ], [1465980669.968384, 95, 0.9300000071525574], [ + 1465980670.007071, 96, 0.8500000238418579 + ], [1465980670.044314, 97, 0.8500000238418579], [ + 1465980670.083472, 98, 0.9100000262260437 + ], [1465980670.214597, 99, 0.8600000143051147], [ + 1465980670.934513, 101, 0.8799999952316284 + ], [1465980670.971317, 102, 0.8700000047683716], [ + 1465980671.003626, 103, 0.8600000143051147 + ], [1465980671.037037, 104, 0.8399999737739563], [ + 1465980671.070037, 105, 0.9200000166893005 + ], [1465980671.104992, 106, 0.8600000143051147], [ + 1465980671.137882, 107, 0.8100000023841858 + ], [1465980671.173917, 108, 0.7400000095367432], [ + 1465980671.205898, 109, 0.8799999952316284 + ], [1465980671.833723, 111, 0.9100000262260437]] + + +def graph_data(): + return """{ + "title": { + "text": "MLP" + }, + "tooltip": {}, + "animationDurationUpdate": 1500, + "animationEasingUpdate": "quinticInOut", + "series": [ + { + "type": "graph", + "layout": "none", + "symbolSize": 50, + "roam": true, + "label": { + "normal": { + "show": true + } + }, + "edgeSymbol": [ + "circle", + "arrow" + ], + "edgeSymbolSize": [ + 4, + 10 + ], + "edgeLabel": { + "normal": { + "textStyle": { + "fontSize": 20 + } + } + }, + "data": [ + { + "name": "X", + "x": 450, + "y": 600 + }, + { + "name": "W1", + "x": 750, + "y": 600 + }, + { + "name": "B1", + "x": 650, + "y": 600 + }, + { + "name": "W2", + "x": 650, + "y": 800 + }, + { + "name": "B2", + "x": 750, + "y": 800 + }, + { + "name": "FC1", + "x": 550, + "y": 700 + }, + { + "name": "RELU", + "x": 550, + "y": 800 + }, + { + "name": "FC2", + "x": 550, + "y": 900 + }, + { + "name": "Y", + "x": 550, + "y": 1000 + } + ], + "links": [ + { + "source": "X", + "target": "FC1" + }, + { + "source": "W1", + "target": "FC1" + }, + { + "source": "B1", + "target": "FC1" + }, + { + "source": "FC1", + "target": "RELU" + }, + { + "source": "RELU", + "target": "FC2" + }, + { + "source": "W2", + "target": "FC2" + }, + { + "source": "B2", + "target": "FC2" + }, + { + "source": "FC2", + "target": "Y" + } + ], + "lineStyle": { + "normal": { + "opacity": 0.9, + "width": 2, + "curveness": 0 + } + } + } + ] +}""" \ No newline at end of file diff --git a/visualdl/server/mock/download_mock_models.sh b/visualdl/server/mock/download_mock_models.sh new file mode 100644 index 000000000..69b2d0506 --- /dev/null +++ b/visualdl/server/mock/download_mock_models.sh @@ -0,0 +1,20 @@ + +# Download inception_v1 model +curl -LOk http://visualdl.bj.bcebos.com/inception_v1.tar.gz +#curl -LOk https://www.dropbox.com/s/twbfdqgvowzy762/inception_v1.tar.gz?dl=0 +tar -xvzf inception_v1.tar.gz +cp inception_v1/model.pb inception_v1_model.pb + +rm -rf inception_v1 +rm inception_v1.tar.gz + + +# Download squeezenet model +curl -LOk http://visualdl.bj.bcebos.com/squeezenet.tar.gz +#curl -LOk https://www.dropbox.com/s/fip3jzxsjf2g6zc/squeezenet.tar.gz?dl=0 +tar -xvzf squeezenet.tar.gz +cp squeezenet/model.pb squeezenet_model.pb + +rm -rf squeezenet +rm squeezenet.tar.gz + diff --git a/visualdl/server/mock/tags.py b/visualdl/server/mock/tags.py new file mode 100644 index 000000000..f37de69c1 --- /dev/null +++ b/visualdl/server/mock/tags.py @@ -0,0 +1,15 @@ +def data(): + return { + "test": { + "min/layer2/weights": { + "displayName": "min/layer2/weights", + "description": "" + } + }, + "train": { + "min/layer2/weights": { + "displayName": "min/layer2/weights", + "description": "" + } + } + } diff --git a/visualdl/server/onnx/READEME.md b/visualdl/server/onnx/READEME.md new file mode 100644 index 000000000..22e926997 --- /dev/null +++ b/visualdl/server/onnx/READEME.md @@ -0,0 +1,2 @@ +## Note +the onnx.proto is port from onnx commit c3137751923f576d14b4212ea444d1562b127a66 diff --git a/visualdl/server/onnx/__init__.py b/visualdl/server/onnx/__init__.py new file mode 100644 index 000000000..0c77f8f6a --- /dev/null +++ b/visualdl/server/onnx/__init__.py @@ -0,0 +1,43 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import google.protobuf.message + +from .onnx_pb2 import ModelProto + + +def load(obj): + ''' + Loads a binary protobuf that stores onnx model + + @params + Takes a file-like object (has "read" function) + or a string containing a file name + @return ONNX ModelProto object + ''' + if hasattr(obj, 'read') and callable(obj.read): + s = obj.read() + else: + with open(obj, 'rb') as f: + s = f.read() + return load_from_string(s) + + +def load_from_string(s): + ''' + Loads a binary string that stores onnx model + + @params + Takes a string object containing protobuf + @return ONNX ModelProto object + ''' + model = ModelProto() + decoded = model.ParseFromString(s) + # in python implementation ParseFromString returns None + if decoded is not None and decoded != len(s): + raise google.protobuf.message.DecodeError( + "Protobuf decoding consumed too few bytes: {} out of {}".format( + decoded, len(s))) + return model diff --git a/visualdl/server/onnx/onnx.proto b/visualdl/server/onnx/onnx.proto new file mode 100644 index 000000000..3a8bb9b66 --- /dev/null +++ b/visualdl/server/onnx/onnx.proto @@ -0,0 +1,420 @@ +// +// WARNING: This file is automatically generated! Please edit onnx.in.proto. +// + + +// Copyright (c) Facebook Inc. and Microsoft Corporation. +// Licensed under the MIT license. + +syntax = "proto2"; + +package onnx; + +// Note [Release] +// We are still in the very early stage of defining ONNX. The current +// version of ONNX is a starting point. While we are actively working +// towards a complete spec, we would like to get the community involved +// by sharing our working version of ONNX. + +// Note [Protobuf compatibility] +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Based on experience working with downstream vendors, we generally can't +// assume recent versions of protobufs. This means that we do not use any +// protobuf features that are only available in proto3. +// +// Here are the most notable contortions we have to carry out to work around +// these limitations: +// +// - No 'map' (added protobuf 3.0). We instead represent mappings as lists +// of key-value pairs, where order does not matter and duplicates +// are not allowed. + +// Note [Namespaces] +// ~~~~~~~~~~~~~~~~~ +// ONNX gives explicit names to graphs, intermediate values and +// serialized tensors. To make it easier to generate names, we organize +// these into separate namespaces (so, e.g., a graph can have the same +// name as a serialized tensor.) The namespaces are as follows: +// +// - Node: These names identify specific nodes in the graph (but not, necessarily +// any particular input or output of the node. +// - Graph: These names identify graphs in the protobuf. +// - Attribute: These names identify attribute names for extra attributes that +// are passed to operators. +// - Operator: These names identify particular operators. +// - Value: These names identify intermediate values (typically tensors) flowing through +// the computation of a graph. +// - Shape: These names represent parameters for unknown shape dimensions. +// +// We specify the namespace of a name in ONNX as comments in the form +// of "namespace {Node,Graph,Operator,Attribute,Value,Shape}". Framework is responsible +// for supporting the namespaces. +// +// Naming things is hard. Every element with a name has an optional doc_string associated +// with it, providing a human-readable description in text markdown. + +// To be compatible with both proto2 and proto3, we will use a version number +// that is not defined by the default value but an explicit enum number. +enum Version { + // proto3 requires the first enum value to be zero. + // We add this just to appease the compiler. + _START_VERSION = 0; + // The version field is always serialized and we will use it to store the + // version that the graph is generated from. This helps us set up version + // control. We should use version as + // xx(major) - xx(minor) - xxxx(bugfix) + // and we are starting with 0x00000001 (0.0.1), which was the + // version we published on Oct 10, 2017. + IR_VERSION_2017_10_10 = 0x00000001; + + // IR_VERSION 0.0.2 published on Oct 30, 2017 + // - Added type discriminator to AttributeProto to support proto3 users + IR_VERSION_2017_10_30 = 0x00000002; + + // IR VERSION 0.0.3 published on Nov 3, 2017 + // - For operator versioning: + // - Added new message OperatorSetIdProto + // - Added opset_import in ModelProto + // - For vendor extensions, added domain in NodeProto + IR_VERSION = 0x00000003; +} + +// A named attribute containing either singular float, integer, string +// and tensor values, or repeated float, integer, string and tensor values. +// An AttributeProto MUST contain the name field, and *only one* of the +// following content fields, effectively enforcing a C/C++ union equivalent. +message AttributeProto { + + // Note: this enum is structurally identical to the OpSchema::AttrType + // enum defined in schema.h. If you rev one, you likely need to rev the other. + enum AttributeType { + UNDEFINED = 0; + FLOAT = 1; + INT = 2; + STRING = 3; + TENSOR = 4; + GRAPH = 5; + + FLOATS = 6; + INTS = 7; + STRINGS = 8; + TENSORS = 9; + GRAPHS = 10; + } + + // The name field MUST be present for this version of the IR. + optional string name = 1; // namespace Attribute + + // A human-readable documentation for this attribute. Markdown is allowed. + optional string doc_string = 13; + + // The type field MUST be present for this version of the IR. + // For 0.0.1 versions of the IR, this field was not defined, and + // implementations needed to use has_field hueristics to determine + // which value field was in use. For IR_VERSION 0.0.2 or later, this + // field MUST be set and match the f|i|s|t|... field in use. This + // change was made to accomodate proto3 implementations. + optional AttributeType type = 20; // discriminator that indicates which field below is in use + + // Exactly ONE of the following fields must be present for this version of the IR + optional float f = 2; // float + optional int64 i = 3; // int + optional bytes s = 4; // UTF-8 string + optional TensorProto t = 5; // tensor value + optional GraphProto g = 6; // graph + // Do not use field below, it's deprecated. + // optional ValueProto v = 12; // value - subsumes everything but graph + + repeated float floats = 7; // list of floats + repeated int64 ints = 8; // list of ints + repeated bytes strings = 9; // list of UTF-8 strings + repeated TensorProto tensors = 10; // list of tensors + repeated GraphProto graphs = 11; // list of graph +} + +// Defines information on value, including the name, the type, and +// the shape of the value. +message ValueInfoProto { + // This field MUST be present in this version of the IR. + optional string name = 1; // namespace Value + // This field MUST be present in this version of the IR. + optional TypeProto type = 2; + // A human-readable documentation for this value. Markdown is allowed. + optional string doc_string = 3; +} + +// NodeProto stores a node that is similar to the notion of "layer" +// or "operator" in many deep learning frameworks. For example, it can be a +// node of type "Conv" that takes in an image, a filter tensor and a bias +// tensor, and produces the convolved output. +message NodeProto { + repeated string input = 1; // namespace Value + repeated string output = 2; // namespace Value + + // An optional identifier for this node in a graph. + // This field MAY be absent in ths version of the IR. + optional string name = 3; // namespace Node + + // The symbolic identifier of the Operator to execute. + optional string op_type = 4; // namespace Operator + // The domain of the OperatorSet that specifies the operator named by op_type. + optional string domain = 7; // namespace Domain + + // Additional named attributes. + // NOTE: Simply using ValueProto.NameValuePairProto is the most general + // solution. I kept AttributeProto to minimize churn on CI results. + repeated AttributeProto attribute = 5; + + // A human-readable documentation for this node. Markdown is allowed. + optional string doc_string = 6; +} + +// ModelProto is a top-level file/container format for bundling a ML model. +// The semantics of the model are described by the GraphProto that represents +// a parameterized computation graph against a set of named operators that are +// defined independently from the graph. +message ModelProto { + // The version of the IR this model targets. See Version enum above. + // This field MUST be present. + optional int64 ir_version = 1; + + // The OperatorSets this model relies on. + // All ModelProtos MUST have at least one entry that + // specifies which version of the ONNX OperatorSet is + // being imported. + // + // All nodes in the ModelProto's graph will bind against the operator + // with the same-domain/same-op_type operator with the HIGHEST version + // in the referenced operator sets. + repeated OperatorSetIdProto opset_import = 8; + + // The name of the framework or tool used to generate this model. + // This field SHOULD be present to indicate which implementation/tool/framework + // emitted the model. + optional string producer_name = 2; + + // The version of the framework or tool used to generate this model. + // This field SHOULD be present to indicate which implementation/tool/framework + // emitted the model. + optional string producer_version = 3; + + // Domain name of the model. + // We use reverse domain names as name space indicators. For example: + // `com.facebook.fair` or `com.microsoft.cognitiveservices` + // + // Together with `model_version` and GraphProto.name, this forms the unique identity of + // the graph. + optional string domain = 4; + + // The version of the graph encoded. See Version enum below. + optional int64 model_version = 5; + + // A human-readable documentation for this model. Markdown is allowed. + optional string doc_string = 6; + + // The parameterized graph that is evaluated to execute the model. + optional GraphProto graph = 7; + + // Named metadata values; keys should be distinct. + repeated StringStringEntryProto metadata_props = 14; +}; + +// StringStringEntryProto follows the pattern for cross-proto-version maps. +// See https://developers.google.com/protocol-buffers/docs/proto3#maps +message StringStringEntryProto { + optional string key = 1; + optional string value= 2; +}; + +// GraphProto defines a parameterized series of nodes to form a directed acyclic graph. +// This is the equivalent of the "network" and "graph" in many deep learning +// frameworks. +message GraphProto { + // The nodes in the graph. + repeated NodeProto node = 1; + + // The name of the graph. + optional string name = 2; // namespace Graph + + // A list of named tensor values (constants), used to specify default + // values for some of the inputs of the graph. + // Each TensorProto entry must have a distinct name (within the list) that + // also appears in the input list. + // In an evaluation, the default value specified here is used if and only if + // user specifies no value for the corresponding input parameter. + // May be used to pass serialized parameters for networks. + repeated TensorProto initializer = 5; + + // A human-readable documentation for this graph. Markdown is allowed. + optional string doc_string = 10; + + // The inputs and outputs of the graph. + repeated ValueInfoProto input = 11; + repeated ValueInfoProto output = 12; + + // Information for the values in the graph. The ValueInfoProto.name's + // must be distinct. It is optional for a value to appear in value_info list. + repeated ValueInfoProto value_info = 13; + + // DO NOT USE the following fields, they were deprecated before + // repeated string input = 3; + // repeated string output = 4; + // optional int64 ir_version = 6; + // optional int64 producer_version = 7; + // optional string producer_tag = 8; + // optional string domain = 9; +} + +// A message defined to store a tensor in its serialized format. +message TensorProto { + enum DataType { + UNDEFINED = 0; + // Basic types. + FLOAT = 1; // float + UINT8 = 2; // uint8_t + INT8 = 3; // int8_t + UINT16 = 4; // uint16_t + INT16 = 5; // int16_t + INT32 = 6; // int32_t + INT64 = 7; // int64_t + STRING = 8; // string + BOOL = 9; // bool + + // Advanced types + FLOAT16 = 10; + DOUBLE = 11; + UINT32 = 12; + UINT64 = 13; + COMPLEX64 = 14; // complex with float32 real and imaginary components + COMPLEX128 = 15; // complex with float64 real and imaginary components + // Future extensions go here. + } + + // The shape of the tensor. + repeated int64 dims = 1; + + // The data type of the tensor. + optional DataType data_type = 2; + + // For very large tensors, we may want to store them in chunks, in which + // case the following fields will specify the segment that is stored in + // the current TensorProto. + message Segment { + optional int64 begin = 1; + optional int64 end = 2; + } + optional Segment segment = 3; + + // Tensor content must be in the row major order. + // + // Depending on the data_type field, exactly one of the fields below with + // name ending in _data is used to store the elements of the tensor. + + // For float and complex64 values + // Complex64 tensors are encoded as a single array of floats, + // with the real components appearing in odd numbered positions, + // and the corresponding imaginary component apparing in the + // subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] + // is encoded as [1.0, 2.0 ,3.0 ,4.0] + // When this field is present, the data_type field MUST be FLOAT or COMPLEX64. + repeated float float_data = 4 [packed = true]; + + // For int32, uint8, int8, uint16, int16, bool, and float16 values + // float16 values must be bit-wise converted to an uint16_t prior + // to writing to the buffer. + // When this field is present, the data_type field MUST be + // INT32, INT16, INT8, UINT16, INT8, BOOL, or FLOAT32 + repeated int32 int32_data = 5 [packed = true]; + + // For strings. + // Each element of string_data is a UTF-8 encoded Unicode + // string. No trailing null, no leading BOM. The protobuf "string" + // scalar type is not used to match ML community conventions. + // When this field is present, the data_type field MUST be STRING + repeated bytes string_data = 6; + + // For int64. + // When this field is present, the data_type field MUST be INT64 + repeated int64 int64_data = 7 [packed = true]; + + // Optionally, a name for the tensor. + optional string name = 8; // namespace Value + + // A human-readable documentation for this tensor. Markdown is allowed. + optional string doc_string = 12; + + // Serializations can either use one of the fields above, or use this + // raw bytes field. The only exception is the string case, where one is + // required to store the content in the repeated bytes string_data field. + // + // When this raw_data field is used to store tensor value, elements MUST + // be stored in as fixed-width, little-endian order. + // Floating-point data types MUST be stored in IEEE 754 format. + // Complex64 elements must be written as two consecutive FLOAT values, real component first. + // Complex128 elements must be written as two consecutive DOUBLE values, real component first. + // Boolean type MUST be written one byte per tensor element (00000001 for true, 00000000 for false). + // + // Note: the advantage of specific field rather than the raw_data field is + // that in some cases (e.g. int data), protobuf does a better packing via + // variable length storage, and may lead to smaller binary footprint. + // When this field is present, the data_type field MUST NOT be STRING or UNDEFINED + optional bytes raw_data = 9; + + // For double + // Complex64 tensors are encoded as a single array of doubles, + // with the real components appearing in odd numbered positions, + // and the corresponding imaginary component apparing in the + // subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] + // is encoded as [1.0, 2.0 ,3.0 ,4.0] + // When this field is present, the data_type field MUST be DOUBLE or COMPLEX128 + repeated double double_data = 10 [packed = true]; + + // For uint64 and uint32 values + // When this field is present, the data_type field MUST be + // UINT32 or UINT64 + repeated uint64 uint64_data = 11 [packed = true]; +} + +// Defines a tensor shape. A dimension can be either an integer value +// or a symbolic variable. A symbolic variable represents an unknown +// dimension. +message TensorShapeProto { + message Dimension { + oneof value { + int64 dim_value = 1; + string dim_param = 2; // namespace Shape + }; + }; + repeated Dimension dim = 1; +} + +// Define the types. +message TypeProto { + + message Tensor { + // This field MUST NOT have the value of UNDEFINED + // This field MUST be present for this version of the IR. + optional TensorProto.DataType elem_type = 1; + optional TensorShapeProto shape = 2; + } + + + oneof value { + // The type of a tensor. + Tensor tensor_type = 1; + + } +} + +// OperatorSets are uniquely identified by a (domain, opset_version) pair. +message OperatorSetIdProto { + // The domain of the operator set being identified. + // The empty string ("") or absence of this field implies the operator + // set that is defined as part of the ONNX specification. + // This field MUST be present in this version of the IR when referring to any other operator set. + optional string domain = 1; + + // The version of the operator set being identified. + // This field MUST be present in this version of the IR. + optional int64 version = 2; +} \ No newline at end of file diff --git a/visualdl/server/onnx/onnx_pb2.py b/visualdl/server/onnx/onnx_pb2.py new file mode 100644 index 000000000..35971a895 --- /dev/null +++ b/visualdl/server/onnx/onnx_pb2.py @@ -0,0 +1,1098 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: visualdl/onnx/onnx.proto + +import sys + +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +from google.protobuf.internal import enum_type_wrapper + +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='visualdl/onnx/onnx.proto', + package='onnx', + serialized_pb=_b('\n\x18visualdl/onnx/onnx.proto\x12\x04onnx\"\xc9\x03\n\x0e\x41ttributeProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\ndoc_string\x18\r \x01(\t\x12\x30\n\x04type\x18\x14 \x01(\x0e\x32\".onnx.AttributeProto.AttributeType\x12\t\n\x01\x66\x18\x02 \x01(\x02\x12\t\n\x01i\x18\x03 \x01(\x03\x12\t\n\x01s\x18\x04 \x01(\x0c\x12\x1c\n\x01t\x18\x05 \x01(\x0b\x32\x11.onnx.TensorProto\x12\x1b\n\x01g\x18\x06 \x01(\x0b\x32\x10.onnx.GraphProto\x12\x0e\n\x06\x66loats\x18\x07 \x03(\x02\x12\x0c\n\x04ints\x18\x08 \x03(\x03\x12\x0f\n\x07strings\x18\t \x03(\x0c\x12\"\n\x07tensors\x18\n \x03(\x0b\x32\x11.onnx.TensorProto\x12 \n\x06graphs\x18\x0b \x03(\x0b\x32\x10.onnx.GraphProto\"\x91\x01\n\rAttributeType\x12\r\n\tUNDEFINED\x10\x00\x12\t\n\x05\x46LOAT\x10\x01\x12\x07\n\x03INT\x10\x02\x12\n\n\x06STRING\x10\x03\x12\n\n\x06TENSOR\x10\x04\x12\t\n\x05GRAPH\x10\x05\x12\n\n\x06\x46LOATS\x10\x06\x12\x08\n\x04INTS\x10\x07\x12\x0b\n\x07STRINGS\x10\x08\x12\x0b\n\x07TENSORS\x10\t\x12\n\n\x06GRAPHS\x10\n\"Q\n\x0eValueInfoProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x1d\n\x04type\x18\x02 \x01(\x0b\x32\x0f.onnx.TypeProto\x12\x12\n\ndoc_string\x18\x03 \x01(\t\"\x96\x01\n\tNodeProto\x12\r\n\x05input\x18\x01 \x03(\t\x12\x0e\n\x06output\x18\x02 \x03(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x0f\n\x07op_type\x18\x04 \x01(\t\x12\x0e\n\x06\x64omain\x18\x07 \x01(\t\x12\'\n\tattribute\x18\x05 \x03(\x0b\x32\x14.onnx.AttributeProto\x12\x12\n\ndoc_string\x18\x06 \x01(\t\"\x93\x02\n\nModelProto\x12\x12\n\nir_version\x18\x01 \x01(\x03\x12.\n\x0copset_import\x18\x08 \x03(\x0b\x32\x18.onnx.OperatorSetIdProto\x12\x15\n\rproducer_name\x18\x02 \x01(\t\x12\x18\n\x10producer_version\x18\x03 \x01(\t\x12\x0e\n\x06\x64omain\x18\x04 \x01(\t\x12\x15\n\rmodel_version\x18\x05 \x01(\x03\x12\x12\n\ndoc_string\x18\x06 \x01(\t\x12\x1f\n\x05graph\x18\x07 \x01(\x0b\x32\x10.onnx.GraphProto\x12\x34\n\x0emetadata_props\x18\x0e \x03(\x0b\x32\x1c.onnx.StringStringEntryProto\"4\n\x16StringStringEntryProto\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"\xea\x01\n\nGraphProto\x12\x1d\n\x04node\x18\x01 \x03(\x0b\x32\x0f.onnx.NodeProto\x12\x0c\n\x04name\x18\x02 \x01(\t\x12&\n\x0binitializer\x18\x05 \x03(\x0b\x32\x11.onnx.TensorProto\x12\x12\n\ndoc_string\x18\n \x01(\t\x12#\n\x05input\x18\x0b \x03(\x0b\x32\x14.onnx.ValueInfoProto\x12$\n\x06output\x18\x0c \x03(\x0b\x32\x14.onnx.ValueInfoProto\x12(\n\nvalue_info\x18\r \x03(\x0b\x32\x14.onnx.ValueInfoProto\"\xaf\x04\n\x0bTensorProto\x12\x0c\n\x04\x64ims\x18\x01 \x03(\x03\x12-\n\tdata_type\x18\x02 \x01(\x0e\x32\x1a.onnx.TensorProto.DataType\x12*\n\x07segment\x18\x03 \x01(\x0b\x32\x19.onnx.TensorProto.Segment\x12\x16\n\nfloat_data\x18\x04 \x03(\x02\x42\x02\x10\x01\x12\x16\n\nint32_data\x18\x05 \x03(\x05\x42\x02\x10\x01\x12\x13\n\x0bstring_data\x18\x06 \x03(\x0c\x12\x16\n\nint64_data\x18\x07 \x03(\x03\x42\x02\x10\x01\x12\x0c\n\x04name\x18\x08 \x01(\t\x12\x12\n\ndoc_string\x18\x0c \x01(\t\x12\x10\n\x08raw_data\x18\t \x01(\x0c\x12\x17\n\x0b\x64ouble_data\x18\n \x03(\x01\x42\x02\x10\x01\x12\x17\n\x0buint64_data\x18\x0b \x03(\x04\x42\x02\x10\x01\x1a%\n\x07Segment\x12\r\n\x05\x62\x65gin\x18\x01 \x01(\x03\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x03\"\xcc\x01\n\x08\x44\x61taType\x12\r\n\tUNDEFINED\x10\x00\x12\t\n\x05\x46LOAT\x10\x01\x12\t\n\x05UINT8\x10\x02\x12\x08\n\x04INT8\x10\x03\x12\n\n\x06UINT16\x10\x04\x12\t\n\x05INT16\x10\x05\x12\t\n\x05INT32\x10\x06\x12\t\n\x05INT64\x10\x07\x12\n\n\x06STRING\x10\x08\x12\x08\n\x04\x42OOL\x10\t\x12\x0b\n\x07\x46LOAT16\x10\n\x12\n\n\x06\x44OUBLE\x10\x0b\x12\n\n\x06UINT32\x10\x0c\x12\n\n\x06UINT64\x10\r\x12\r\n\tCOMPLEX64\x10\x0e\x12\x0e\n\nCOMPLEX128\x10\x0f\"\x81\x01\n\x10TensorShapeProto\x12-\n\x03\x64im\x18\x01 \x03(\x0b\x32 .onnx.TensorShapeProto.Dimension\x1a>\n\tDimension\x12\x13\n\tdim_value\x18\x01 \x01(\x03H\x00\x12\x13\n\tdim_param\x18\x02 \x01(\tH\x00\x42\x07\n\x05value\"\xa3\x01\n\tTypeProto\x12-\n\x0btensor_type\x18\x01 \x01(\x0b\x32\x16.onnx.TypeProto.TensorH\x00\x1a^\n\x06Tensor\x12-\n\telem_type\x18\x01 \x01(\x0e\x32\x1a.onnx.TensorProto.DataType\x12%\n\x05shape\x18\x02 \x01(\x0b\x32\x16.onnx.TensorShapeProtoB\x07\n\x05value\"5\n\x12OperatorSetIdProto\x12\x0e\n\x06\x64omain\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\x03*c\n\x07Version\x12\x12\n\x0e_START_VERSION\x10\x00\x12\x19\n\x15IR_VERSION_2017_10_10\x10\x01\x12\x19\n\x15IR_VERSION_2017_10_30\x10\x02\x12\x0e\n\nIR_VERSION\x10\x03') +) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +_VERSION = _descriptor.EnumDescriptor( + name='Version', + full_name='onnx.Version', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='_START_VERSION', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='IR_VERSION_2017_10_10', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='IR_VERSION_2017_10_30', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='IR_VERSION', index=3, number=3, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=2214, + serialized_end=2313, +) +_sym_db.RegisterEnumDescriptor(_VERSION) + +Version = enum_type_wrapper.EnumTypeWrapper(_VERSION) +_START_VERSION = 0 +IR_VERSION_2017_10_10 = 1 +IR_VERSION_2017_10_30 = 2 +IR_VERSION = 3 + + +_ATTRIBUTEPROTO_ATTRIBUTETYPE = _descriptor.EnumDescriptor( + name='AttributeType', + full_name='onnx.AttributeProto.AttributeType', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='UNDEFINED', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FLOAT', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INT', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='STRING', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TENSOR', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GRAPH', index=5, number=5, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FLOATS', index=6, number=6, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INTS', index=7, number=7, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='STRINGS', index=8, number=8, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TENSORS', index=9, number=9, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GRAPHS', index=10, number=10, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=347, + serialized_end=492, +) +_sym_db.RegisterEnumDescriptor(_ATTRIBUTEPROTO_ATTRIBUTETYPE) + +_TENSORPROTO_DATATYPE = _descriptor.EnumDescriptor( + name='DataType', + full_name='onnx.TensorProto.DataType', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='UNDEFINED', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FLOAT', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='UINT8', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INT8', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='UINT16', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INT16', index=5, number=5, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INT32', index=6, number=6, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INT64', index=7, number=7, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='STRING', index=8, number=8, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='BOOL', index=9, number=9, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='FLOAT16', index=10, number=10, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DOUBLE', index=11, number=11, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='UINT32', index=12, number=12, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='UINT64', index=13, number=13, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='COMPLEX64', index=14, number=14, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='COMPLEX128', index=15, number=15, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=1655, + serialized_end=1859, +) +_sym_db.RegisterEnumDescriptor(_TENSORPROTO_DATATYPE) + + +_ATTRIBUTEPROTO = _descriptor.Descriptor( + name='AttributeProto', + full_name='onnx.AttributeProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='onnx.AttributeProto.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='doc_string', full_name='onnx.AttributeProto.doc_string', index=1, + number=13, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='type', full_name='onnx.AttributeProto.type', index=2, + number=20, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='f', full_name='onnx.AttributeProto.f', index=3, + number=2, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='i', full_name='onnx.AttributeProto.i', index=4, + number=3, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='s', full_name='onnx.AttributeProto.s', index=5, + number=4, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='t', full_name='onnx.AttributeProto.t', index=6, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='g', full_name='onnx.AttributeProto.g', index=7, + number=6, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='floats', full_name='onnx.AttributeProto.floats', index=8, + number=7, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='ints', full_name='onnx.AttributeProto.ints', index=9, + number=8, type=3, cpp_type=2, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='strings', full_name='onnx.AttributeProto.strings', index=10, + number=9, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='tensors', full_name='onnx.AttributeProto.tensors', index=11, + number=10, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='graphs', full_name='onnx.AttributeProto.graphs', index=12, + number=11, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _ATTRIBUTEPROTO_ATTRIBUTETYPE, + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=35, + serialized_end=492, +) + + +_VALUEINFOPROTO = _descriptor.Descriptor( + name='ValueInfoProto', + full_name='onnx.ValueInfoProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='onnx.ValueInfoProto.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='type', full_name='onnx.ValueInfoProto.type', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='doc_string', full_name='onnx.ValueInfoProto.doc_string', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=494, + serialized_end=575, +) + + +_NODEPROTO = _descriptor.Descriptor( + name='NodeProto', + full_name='onnx.NodeProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='input', full_name='onnx.NodeProto.input', index=0, + number=1, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='output', full_name='onnx.NodeProto.output', index=1, + number=2, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='name', full_name='onnx.NodeProto.name', index=2, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='op_type', full_name='onnx.NodeProto.op_type', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='domain', full_name='onnx.NodeProto.domain', index=4, + number=7, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='attribute', full_name='onnx.NodeProto.attribute', index=5, + number=5, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='doc_string', full_name='onnx.NodeProto.doc_string', index=6, + number=6, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=578, + serialized_end=728, +) + + +_MODELPROTO = _descriptor.Descriptor( + name='ModelProto', + full_name='onnx.ModelProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='ir_version', full_name='onnx.ModelProto.ir_version', index=0, + number=1, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='opset_import', full_name='onnx.ModelProto.opset_import', index=1, + number=8, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='producer_name', full_name='onnx.ModelProto.producer_name', index=2, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='producer_version', full_name='onnx.ModelProto.producer_version', index=3, + number=3, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='domain', full_name='onnx.ModelProto.domain', index=4, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='model_version', full_name='onnx.ModelProto.model_version', index=5, + number=5, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='doc_string', full_name='onnx.ModelProto.doc_string', index=6, + number=6, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='graph', full_name='onnx.ModelProto.graph', index=7, + number=7, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='metadata_props', full_name='onnx.ModelProto.metadata_props', index=8, + number=14, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=731, + serialized_end=1006, +) + + +_STRINGSTRINGENTRYPROTO = _descriptor.Descriptor( + name='StringStringEntryProto', + full_name='onnx.StringStringEntryProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='key', full_name='onnx.StringStringEntryProto.key', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='value', full_name='onnx.StringStringEntryProto.value', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=1008, + serialized_end=1060, +) + + +_GRAPHPROTO = _descriptor.Descriptor( + name='GraphProto', + full_name='onnx.GraphProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='node', full_name='onnx.GraphProto.node', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='name', full_name='onnx.GraphProto.name', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='initializer', full_name='onnx.GraphProto.initializer', index=2, + number=5, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='doc_string', full_name='onnx.GraphProto.doc_string', index=3, + number=10, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='input', full_name='onnx.GraphProto.input', index=4, + number=11, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='output', full_name='onnx.GraphProto.output', index=5, + number=12, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='value_info', full_name='onnx.GraphProto.value_info', index=6, + number=13, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=1063, + serialized_end=1297, +) + + +_TENSORPROTO_SEGMENT = _descriptor.Descriptor( + name='Segment', + full_name='onnx.TensorProto.Segment', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='begin', full_name='onnx.TensorProto.Segment.begin', index=0, + number=1, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='end', full_name='onnx.TensorProto.Segment.end', index=1, + number=2, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=1615, + serialized_end=1652, +) + +_TENSORPROTO = _descriptor.Descriptor( + name='TensorProto', + full_name='onnx.TensorProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='dims', full_name='onnx.TensorProto.dims', index=0, + number=1, type=3, cpp_type=2, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='data_type', full_name='onnx.TensorProto.data_type', index=1, + number=2, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='segment', full_name='onnx.TensorProto.segment', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='float_data', full_name='onnx.TensorProto.float_data', index=3, + number=4, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001'))), + _descriptor.FieldDescriptor( + name='int32_data', full_name='onnx.TensorProto.int32_data', index=4, + number=5, type=5, cpp_type=1, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001'))), + _descriptor.FieldDescriptor( + name='string_data', full_name='onnx.TensorProto.string_data', index=5, + number=6, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='int64_data', full_name='onnx.TensorProto.int64_data', index=6, + number=7, type=3, cpp_type=2, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001'))), + _descriptor.FieldDescriptor( + name='name', full_name='onnx.TensorProto.name', index=7, + number=8, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='doc_string', full_name='onnx.TensorProto.doc_string', index=8, + number=12, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='raw_data', full_name='onnx.TensorProto.raw_data', index=9, + number=9, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='double_data', full_name='onnx.TensorProto.double_data', index=10, + number=10, type=1, cpp_type=5, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001'))), + _descriptor.FieldDescriptor( + name='uint64_data', full_name='onnx.TensorProto.uint64_data', index=11, + number=11, type=4, cpp_type=4, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001'))), + ], + extensions=[ + ], + nested_types=[_TENSORPROTO_SEGMENT, ], + enum_types=[ + _TENSORPROTO_DATATYPE, + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=1300, + serialized_end=1859, +) + + +_TENSORSHAPEPROTO_DIMENSION = _descriptor.Descriptor( + name='Dimension', + full_name='onnx.TensorShapeProto.Dimension', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='dim_value', full_name='onnx.TensorShapeProto.Dimension.dim_value', index=0, + number=1, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='dim_param', full_name='onnx.TensorShapeProto.Dimension.dim_param', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='value', full_name='onnx.TensorShapeProto.Dimension.value', + index=0, containing_type=None, fields=[]), + ], + serialized_start=1929, + serialized_end=1991, +) + +_TENSORSHAPEPROTO = _descriptor.Descriptor( + name='TensorShapeProto', + full_name='onnx.TensorShapeProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='dim', full_name='onnx.TensorShapeProto.dim', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[_TENSORSHAPEPROTO_DIMENSION, ], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=1862, + serialized_end=1991, +) + + +_TYPEPROTO_TENSOR = _descriptor.Descriptor( + name='Tensor', + full_name='onnx.TypeProto.Tensor', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='elem_type', full_name='onnx.TypeProto.Tensor.elem_type', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='shape', full_name='onnx.TypeProto.Tensor.shape', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=2054, + serialized_end=2148, +) + +_TYPEPROTO = _descriptor.Descriptor( + name='TypeProto', + full_name='onnx.TypeProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='tensor_type', full_name='onnx.TypeProto.tensor_type', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[_TYPEPROTO_TENSOR, ], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name='value', full_name='onnx.TypeProto.value', + index=0, containing_type=None, fields=[]), + ], + serialized_start=1994, + serialized_end=2157, +) + + +_OPERATORSETIDPROTO = _descriptor.Descriptor( + name='OperatorSetIdProto', + full_name='onnx.OperatorSetIdProto', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='domain', full_name='onnx.OperatorSetIdProto.domain', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='version', full_name='onnx.OperatorSetIdProto.version', index=1, + number=2, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + extension_ranges=[], + oneofs=[ + ], + serialized_start=2159, + serialized_end=2212, +) + +_ATTRIBUTEPROTO.fields_by_name['type'].enum_type = _ATTRIBUTEPROTO_ATTRIBUTETYPE +_ATTRIBUTEPROTO.fields_by_name['t'].message_type = _TENSORPROTO +_ATTRIBUTEPROTO.fields_by_name['g'].message_type = _GRAPHPROTO +_ATTRIBUTEPROTO.fields_by_name['tensors'].message_type = _TENSORPROTO +_ATTRIBUTEPROTO.fields_by_name['graphs'].message_type = _GRAPHPROTO +_ATTRIBUTEPROTO_ATTRIBUTETYPE.containing_type = _ATTRIBUTEPROTO +_VALUEINFOPROTO.fields_by_name['type'].message_type = _TYPEPROTO +_NODEPROTO.fields_by_name['attribute'].message_type = _ATTRIBUTEPROTO +_MODELPROTO.fields_by_name['opset_import'].message_type = _OPERATORSETIDPROTO +_MODELPROTO.fields_by_name['graph'].message_type = _GRAPHPROTO +_MODELPROTO.fields_by_name['metadata_props'].message_type = _STRINGSTRINGENTRYPROTO +_GRAPHPROTO.fields_by_name['node'].message_type = _NODEPROTO +_GRAPHPROTO.fields_by_name['initializer'].message_type = _TENSORPROTO +_GRAPHPROTO.fields_by_name['input'].message_type = _VALUEINFOPROTO +_GRAPHPROTO.fields_by_name['output'].message_type = _VALUEINFOPROTO +_GRAPHPROTO.fields_by_name['value_info'].message_type = _VALUEINFOPROTO +_TENSORPROTO_SEGMENT.containing_type = _TENSORPROTO +_TENSORPROTO.fields_by_name['data_type'].enum_type = _TENSORPROTO_DATATYPE +_TENSORPROTO.fields_by_name['segment'].message_type = _TENSORPROTO_SEGMENT +_TENSORPROTO_DATATYPE.containing_type = _TENSORPROTO +_TENSORSHAPEPROTO_DIMENSION.containing_type = _TENSORSHAPEPROTO +_TENSORSHAPEPROTO_DIMENSION.oneofs_by_name['value'].fields.append( + _TENSORSHAPEPROTO_DIMENSION.fields_by_name['dim_value']) +_TENSORSHAPEPROTO_DIMENSION.fields_by_name['dim_value'].containing_oneof = _TENSORSHAPEPROTO_DIMENSION.oneofs_by_name['value'] +_TENSORSHAPEPROTO_DIMENSION.oneofs_by_name['value'].fields.append( + _TENSORSHAPEPROTO_DIMENSION.fields_by_name['dim_param']) +_TENSORSHAPEPROTO_DIMENSION.fields_by_name['dim_param'].containing_oneof = _TENSORSHAPEPROTO_DIMENSION.oneofs_by_name['value'] +_TENSORSHAPEPROTO.fields_by_name['dim'].message_type = _TENSORSHAPEPROTO_DIMENSION +_TYPEPROTO_TENSOR.fields_by_name['elem_type'].enum_type = _TENSORPROTO_DATATYPE +_TYPEPROTO_TENSOR.fields_by_name['shape'].message_type = _TENSORSHAPEPROTO +_TYPEPROTO_TENSOR.containing_type = _TYPEPROTO +_TYPEPROTO.fields_by_name['tensor_type'].message_type = _TYPEPROTO_TENSOR +_TYPEPROTO.oneofs_by_name['value'].fields.append( + _TYPEPROTO.fields_by_name['tensor_type']) +_TYPEPROTO.fields_by_name['tensor_type'].containing_oneof = _TYPEPROTO.oneofs_by_name['value'] +DESCRIPTOR.message_types_by_name['AttributeProto'] = _ATTRIBUTEPROTO +DESCRIPTOR.message_types_by_name['ValueInfoProto'] = _VALUEINFOPROTO +DESCRIPTOR.message_types_by_name['NodeProto'] = _NODEPROTO +DESCRIPTOR.message_types_by_name['ModelProto'] = _MODELPROTO +DESCRIPTOR.message_types_by_name['StringStringEntryProto'] = _STRINGSTRINGENTRYPROTO +DESCRIPTOR.message_types_by_name['GraphProto'] = _GRAPHPROTO +DESCRIPTOR.message_types_by_name['TensorProto'] = _TENSORPROTO +DESCRIPTOR.message_types_by_name['TensorShapeProto'] = _TENSORSHAPEPROTO +DESCRIPTOR.message_types_by_name['TypeProto'] = _TYPEPROTO +DESCRIPTOR.message_types_by_name['OperatorSetIdProto'] = _OPERATORSETIDPROTO +DESCRIPTOR.enum_types_by_name['Version'] = _VERSION + +AttributeProto = _reflection.GeneratedProtocolMessageType('AttributeProto', (_message.Message,), dict( + DESCRIPTOR = _ATTRIBUTEPROTO, + __module__ = 'visualdl.onnx.onnx_pb2' + # @@protoc_insertion_point(class_scope:onnx.AttributeProto) + )) +_sym_db.RegisterMessage(AttributeProto) + +ValueInfoProto = _reflection.GeneratedProtocolMessageType('ValueInfoProto', (_message.Message,), dict( + DESCRIPTOR = _VALUEINFOPROTO, + __module__ = 'visualdl.onnx.onnx_pb2' + # @@protoc_insertion_point(class_scope:onnx.ValueInfoProto) + )) +_sym_db.RegisterMessage(ValueInfoProto) + +NodeProto = _reflection.GeneratedProtocolMessageType('NodeProto', (_message.Message,), dict( + DESCRIPTOR = _NODEPROTO, + __module__ = 'visualdl.onnx.onnx_pb2' + # @@protoc_insertion_point(class_scope:onnx.NodeProto) + )) +_sym_db.RegisterMessage(NodeProto) + +ModelProto = _reflection.GeneratedProtocolMessageType('ModelProto', (_message.Message,), dict( + DESCRIPTOR = _MODELPROTO, + __module__ = 'visualdl.onnx.onnx_pb2' + # @@protoc_insertion_point(class_scope:onnx.ModelProto) + )) +_sym_db.RegisterMessage(ModelProto) + +StringStringEntryProto = _reflection.GeneratedProtocolMessageType('StringStringEntryProto', (_message.Message,), dict( + DESCRIPTOR = _STRINGSTRINGENTRYPROTO, + __module__ = 'visualdl.onnx.onnx_pb2' + # @@protoc_insertion_point(class_scope:onnx.StringStringEntryProto) + )) +_sym_db.RegisterMessage(StringStringEntryProto) + +GraphProto = _reflection.GeneratedProtocolMessageType('GraphProto', (_message.Message,), dict( + DESCRIPTOR = _GRAPHPROTO, + __module__ = 'visualdl.onnx.onnx_pb2' + # @@protoc_insertion_point(class_scope:onnx.GraphProto) + )) +_sym_db.RegisterMessage(GraphProto) + +TensorProto = _reflection.GeneratedProtocolMessageType('TensorProto', (_message.Message,), dict( + + Segment = _reflection.GeneratedProtocolMessageType('Segment', (_message.Message,), dict( + DESCRIPTOR = _TENSORPROTO_SEGMENT, + __module__ = 'visualdl.onnx.onnx_pb2' + # @@protoc_insertion_point(class_scope:onnx.TensorProto.Segment) + )) + , + DESCRIPTOR = _TENSORPROTO, + __module__ = 'visualdl.onnx.onnx_pb2' + # @@protoc_insertion_point(class_scope:onnx.TensorProto) + )) +_sym_db.RegisterMessage(TensorProto) +_sym_db.RegisterMessage(TensorProto.Segment) + +TensorShapeProto = _reflection.GeneratedProtocolMessageType('TensorShapeProto', (_message.Message,), dict( + + Dimension = _reflection.GeneratedProtocolMessageType('Dimension', (_message.Message,), dict( + DESCRIPTOR = _TENSORSHAPEPROTO_DIMENSION, + __module__ = 'visualdl.onnx.onnx_pb2' + # @@protoc_insertion_point(class_scope:onnx.TensorShapeProto.Dimension) + )) + , + DESCRIPTOR = _TENSORSHAPEPROTO, + __module__ = 'visualdl.onnx.onnx_pb2' + # @@protoc_insertion_point(class_scope:onnx.TensorShapeProto) + )) +_sym_db.RegisterMessage(TensorShapeProto) +_sym_db.RegisterMessage(TensorShapeProto.Dimension) + +TypeProto = _reflection.GeneratedProtocolMessageType('TypeProto', (_message.Message,), dict( + + Tensor = _reflection.GeneratedProtocolMessageType('Tensor', (_message.Message,), dict( + DESCRIPTOR = _TYPEPROTO_TENSOR, + __module__ = 'visualdl.onnx.onnx_pb2' + # @@protoc_insertion_point(class_scope:onnx.TypeProto.Tensor) + )) + , + DESCRIPTOR = _TYPEPROTO, + __module__ = 'visualdl.onnx.onnx_pb2' + # @@protoc_insertion_point(class_scope:onnx.TypeProto) + )) +_sym_db.RegisterMessage(TypeProto) +_sym_db.RegisterMessage(TypeProto.Tensor) + +OperatorSetIdProto = _reflection.GeneratedProtocolMessageType('OperatorSetIdProto', (_message.Message,), dict( + DESCRIPTOR = _OPERATORSETIDPROTO, + __module__ = 'visualdl.onnx.onnx_pb2' + # @@protoc_insertion_point(class_scope:onnx.OperatorSetIdProto) + )) +_sym_db.RegisterMessage(OperatorSetIdProto) + + +_TENSORPROTO.fields_by_name['float_data'].has_options = True +_TENSORPROTO.fields_by_name['float_data']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001')) +_TENSORPROTO.fields_by_name['int32_data'].has_options = True +_TENSORPROTO.fields_by_name['int32_data']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001')) +_TENSORPROTO.fields_by_name['int64_data'].has_options = True +_TENSORPROTO.fields_by_name['int64_data']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001')) +_TENSORPROTO.fields_by_name['double_data'].has_options = True +_TENSORPROTO.fields_by_name['double_data']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001')) +_TENSORPROTO.fields_by_name['uint64_data'].has_options = True +_TENSORPROTO.fields_by_name['uint64_data']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001')) +# @@protoc_insertion_point(module_scope) From 09848aae618f9fa2563eecdfa3df1fb7804fae89 Mon Sep 17 00:00:00 2001 From: superjom Date: Sun, 7 Jan 2018 15:21:15 +0800 Subject: [PATCH 07/23] restore graph_test.sh --- visualdl/server/graph_test.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 visualdl/server/graph_test.sh diff --git a/visualdl/server/graph_test.sh b/visualdl/server/graph_test.sh new file mode 100644 index 000000000..b8d4ea650 --- /dev/null +++ b/visualdl/server/graph_test.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -ex + +cd mock +bash download_mock_models.sh + +cd .. + +python graph_test.py + +rm ./mock/*.pb + From 8592a7e244136c9969f3741e093e5b3f097016ae Mon Sep 17 00:00:00 2001 From: superjom Date: Sun, 7 Jan 2018 15:32:36 +0800 Subject: [PATCH 08/23] move visualdl.py to visualdl as a script --- visualdl/server/{visualdl.py => visualdl} | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) rename visualdl/server/{visualdl.py => visualdl} (94%) diff --git a/visualdl/server/visualdl.py b/visualdl/server/visualdl similarity index 94% rename from visualdl/server/visualdl.py rename to visualdl/server/visualdl index 94ca86088..e9a577fe2 100644 --- a/visualdl/server/visualdl.py +++ b/visualdl/server/visualdl @@ -1,3 +1,4 @@ +#! /user/bin/env python from __future__ import absolute_import import json @@ -9,12 +10,11 @@ from flask import (Flask, Response, redirect, request, send_file, send_from_directory) -from visualdl import graph -from visualdl import lib -import storage -from visualdl.mock import data as mock_data -from visualdl.mock import tags as mock_tags -from visualdl.log import logger +from visualdl.server import graph, lib +from visualdl.server import log as logger +from visualdl.server.mock import data as mock_data +from visualdl.server.tags import data as mock_tags +from visualdl import * app = Flask(__name__, static_url_path="") # set static expires in a short time to reduce browser's memory usage. @@ -52,7 +52,7 @@ def option_parser(): static_file_path = "./frontend/dist/" mock_data_path = "./mock_data/" -log_reader = storage.LogReader(options.logdir) +log_reader = LogReader(options.logdir) # return data From 44f8c5bed3b4a2f17b530d644ee0b9eea29d1041 Mon Sep 17 00:00:00 2001 From: superjom Date: Sun, 7 Jan 2018 16:48:19 +0800 Subject: [PATCH 09/23] fix setup --- build.sh | 7 +++++++ setup.py | 9 +++++---- visualdl/__init__.py | 2 -- visualdl/python/storage.py | 4 +++- visualdl/server/{visualdl => visualdl_bin} | 8 +++++--- 5 files changed, 20 insertions(+), 10 deletions(-) rename visualdl/server/{visualdl => visualdl_bin} (97%) diff --git a/build.sh b/build.sh index 8b460367b..b1978b4d6 100644 --- a/build.sh +++ b/build.sh @@ -20,9 +20,15 @@ build_backend() { make -j2 } +build_onnx_graph() { + cd $TOP_DIR/visualdl/server/onnx + protoc onnx.proto --python_out . +} + package() { cp -rf $FRONTEND_DIR/dist $TOP_DIR/visualdl/server/ cp $BUILD_DIR/visualdl/logic/core.so $TOP_DIR/visualdl + cp $BUILD_DIR/visualdl/logic/core.so $TOP_DIR/visualdl/python/ } # package() { @@ -40,4 +46,5 @@ package() { #build_frontend build_backend +build_onnx_graph package diff --git a/setup.py b/setup.py index 070080f67..177bf658c 100644 --- a/setup.py +++ b/setup.py @@ -67,6 +67,8 @@ def run(self): 'visualdl', 'visualdl.python', 'visualdl.server', + 'visualdl.server.mock', + 'visualdl.server.onnx', ] setup( @@ -79,10 +81,9 @@ def run(self): long_description=read('README.md'), install_requires=install_requires, package_data={'visualdl.server': ['dist/*', 'dist/fonts/*'], - 'visualdl':['core.so']}, + 'visualdl':['core.so'], + 'visualdl.python':['core.so']}, packages=packages, - # package_dir={'pip_package': 'visualdl', - # 'frontend.dist': '../frontend/dist'}, - scripts=['visualdl/server/visualdl.py'], + scripts=['visualdl/server/visualdl_bin'], # include_package_data=True, cmdclass=cmdclass) diff --git a/visualdl/__init__.py b/visualdl/__init__.py index 31b48f729..c3961685a 100644 --- a/visualdl/__init__.py +++ b/visualdl/__init__.py @@ -1,3 +1 @@ from __future__ import absolute_import - -from .python.storage import * diff --git a/visualdl/python/storage.py b/visualdl/python/storage.py index f63754043..7a5ee182b 100644 --- a/visualdl/python/storage.py +++ b/visualdl/python/storage.py @@ -1,6 +1,8 @@ from __future__ import absolute_import -from .. import core +import visualdl + +from visualdl import core dtypes = ("float", "double", "int32", "int64") diff --git a/visualdl/server/visualdl b/visualdl/server/visualdl_bin similarity index 97% rename from visualdl/server/visualdl rename to visualdl/server/visualdl_bin index e9a577fe2..d8642cd4d 100644 --- a/visualdl/server/visualdl +++ b/visualdl/server/visualdl_bin @@ -1,5 +1,4 @@ #! /user/bin/env python -from __future__ import absolute_import import json import os @@ -10,11 +9,14 @@ from optparse import OptionParser from flask import (Flask, Response, redirect, request, send_file, send_from_directory) +import visualdl.server from visualdl.server import graph, lib from visualdl.server import log as logger from visualdl.server.mock import data as mock_data -from visualdl.server.tags import data as mock_tags -from visualdl import * +from visualdl.server.mock import data as mock_tags +from visualdl.python.storage import (LogWriter, LogReader) + + app = Flask(__name__, static_url_path="") # set static expires in a short time to reduce browser's memory usage. From aa026a05bf75ca384e3be2d68e2dd57db1ed6b1e Mon Sep 17 00:00:00 2001 From: superjom Date: Sun, 7 Jan 2018 16:48:55 +0800 Subject: [PATCH 10/23] remove onnx_pb2.py --- visualdl/server/onnx/onnx_pb2.py | 1098 ------------------------------ 1 file changed, 1098 deletions(-) delete mode 100644 visualdl/server/onnx/onnx_pb2.py diff --git a/visualdl/server/onnx/onnx_pb2.py b/visualdl/server/onnx/onnx_pb2.py deleted file mode 100644 index 35971a895..000000000 --- a/visualdl/server/onnx/onnx_pb2.py +++ /dev/null @@ -1,1098 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: visualdl/onnx/onnx.proto - -import sys - -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database -from google.protobuf import descriptor_pb2 -from google.protobuf.internal import enum_type_wrapper - -_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='visualdl/onnx/onnx.proto', - package='onnx', - serialized_pb=_b('\n\x18visualdl/onnx/onnx.proto\x12\x04onnx\"\xc9\x03\n\x0e\x41ttributeProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\ndoc_string\x18\r \x01(\t\x12\x30\n\x04type\x18\x14 \x01(\x0e\x32\".onnx.AttributeProto.AttributeType\x12\t\n\x01\x66\x18\x02 \x01(\x02\x12\t\n\x01i\x18\x03 \x01(\x03\x12\t\n\x01s\x18\x04 \x01(\x0c\x12\x1c\n\x01t\x18\x05 \x01(\x0b\x32\x11.onnx.TensorProto\x12\x1b\n\x01g\x18\x06 \x01(\x0b\x32\x10.onnx.GraphProto\x12\x0e\n\x06\x66loats\x18\x07 \x03(\x02\x12\x0c\n\x04ints\x18\x08 \x03(\x03\x12\x0f\n\x07strings\x18\t \x03(\x0c\x12\"\n\x07tensors\x18\n \x03(\x0b\x32\x11.onnx.TensorProto\x12 \n\x06graphs\x18\x0b \x03(\x0b\x32\x10.onnx.GraphProto\"\x91\x01\n\rAttributeType\x12\r\n\tUNDEFINED\x10\x00\x12\t\n\x05\x46LOAT\x10\x01\x12\x07\n\x03INT\x10\x02\x12\n\n\x06STRING\x10\x03\x12\n\n\x06TENSOR\x10\x04\x12\t\n\x05GRAPH\x10\x05\x12\n\n\x06\x46LOATS\x10\x06\x12\x08\n\x04INTS\x10\x07\x12\x0b\n\x07STRINGS\x10\x08\x12\x0b\n\x07TENSORS\x10\t\x12\n\n\x06GRAPHS\x10\n\"Q\n\x0eValueInfoProto\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x1d\n\x04type\x18\x02 \x01(\x0b\x32\x0f.onnx.TypeProto\x12\x12\n\ndoc_string\x18\x03 \x01(\t\"\x96\x01\n\tNodeProto\x12\r\n\x05input\x18\x01 \x03(\t\x12\x0e\n\x06output\x18\x02 \x03(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x0f\n\x07op_type\x18\x04 \x01(\t\x12\x0e\n\x06\x64omain\x18\x07 \x01(\t\x12\'\n\tattribute\x18\x05 \x03(\x0b\x32\x14.onnx.AttributeProto\x12\x12\n\ndoc_string\x18\x06 \x01(\t\"\x93\x02\n\nModelProto\x12\x12\n\nir_version\x18\x01 \x01(\x03\x12.\n\x0copset_import\x18\x08 \x03(\x0b\x32\x18.onnx.OperatorSetIdProto\x12\x15\n\rproducer_name\x18\x02 \x01(\t\x12\x18\n\x10producer_version\x18\x03 \x01(\t\x12\x0e\n\x06\x64omain\x18\x04 \x01(\t\x12\x15\n\rmodel_version\x18\x05 \x01(\x03\x12\x12\n\ndoc_string\x18\x06 \x01(\t\x12\x1f\n\x05graph\x18\x07 \x01(\x0b\x32\x10.onnx.GraphProto\x12\x34\n\x0emetadata_props\x18\x0e \x03(\x0b\x32\x1c.onnx.StringStringEntryProto\"4\n\x16StringStringEntryProto\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t\"\xea\x01\n\nGraphProto\x12\x1d\n\x04node\x18\x01 \x03(\x0b\x32\x0f.onnx.NodeProto\x12\x0c\n\x04name\x18\x02 \x01(\t\x12&\n\x0binitializer\x18\x05 \x03(\x0b\x32\x11.onnx.TensorProto\x12\x12\n\ndoc_string\x18\n \x01(\t\x12#\n\x05input\x18\x0b \x03(\x0b\x32\x14.onnx.ValueInfoProto\x12$\n\x06output\x18\x0c \x03(\x0b\x32\x14.onnx.ValueInfoProto\x12(\n\nvalue_info\x18\r \x03(\x0b\x32\x14.onnx.ValueInfoProto\"\xaf\x04\n\x0bTensorProto\x12\x0c\n\x04\x64ims\x18\x01 \x03(\x03\x12-\n\tdata_type\x18\x02 \x01(\x0e\x32\x1a.onnx.TensorProto.DataType\x12*\n\x07segment\x18\x03 \x01(\x0b\x32\x19.onnx.TensorProto.Segment\x12\x16\n\nfloat_data\x18\x04 \x03(\x02\x42\x02\x10\x01\x12\x16\n\nint32_data\x18\x05 \x03(\x05\x42\x02\x10\x01\x12\x13\n\x0bstring_data\x18\x06 \x03(\x0c\x12\x16\n\nint64_data\x18\x07 \x03(\x03\x42\x02\x10\x01\x12\x0c\n\x04name\x18\x08 \x01(\t\x12\x12\n\ndoc_string\x18\x0c \x01(\t\x12\x10\n\x08raw_data\x18\t \x01(\x0c\x12\x17\n\x0b\x64ouble_data\x18\n \x03(\x01\x42\x02\x10\x01\x12\x17\n\x0buint64_data\x18\x0b \x03(\x04\x42\x02\x10\x01\x1a%\n\x07Segment\x12\r\n\x05\x62\x65gin\x18\x01 \x01(\x03\x12\x0b\n\x03\x65nd\x18\x02 \x01(\x03\"\xcc\x01\n\x08\x44\x61taType\x12\r\n\tUNDEFINED\x10\x00\x12\t\n\x05\x46LOAT\x10\x01\x12\t\n\x05UINT8\x10\x02\x12\x08\n\x04INT8\x10\x03\x12\n\n\x06UINT16\x10\x04\x12\t\n\x05INT16\x10\x05\x12\t\n\x05INT32\x10\x06\x12\t\n\x05INT64\x10\x07\x12\n\n\x06STRING\x10\x08\x12\x08\n\x04\x42OOL\x10\t\x12\x0b\n\x07\x46LOAT16\x10\n\x12\n\n\x06\x44OUBLE\x10\x0b\x12\n\n\x06UINT32\x10\x0c\x12\n\n\x06UINT64\x10\r\x12\r\n\tCOMPLEX64\x10\x0e\x12\x0e\n\nCOMPLEX128\x10\x0f\"\x81\x01\n\x10TensorShapeProto\x12-\n\x03\x64im\x18\x01 \x03(\x0b\x32 .onnx.TensorShapeProto.Dimension\x1a>\n\tDimension\x12\x13\n\tdim_value\x18\x01 \x01(\x03H\x00\x12\x13\n\tdim_param\x18\x02 \x01(\tH\x00\x42\x07\n\x05value\"\xa3\x01\n\tTypeProto\x12-\n\x0btensor_type\x18\x01 \x01(\x0b\x32\x16.onnx.TypeProto.TensorH\x00\x1a^\n\x06Tensor\x12-\n\telem_type\x18\x01 \x01(\x0e\x32\x1a.onnx.TensorProto.DataType\x12%\n\x05shape\x18\x02 \x01(\x0b\x32\x16.onnx.TensorShapeProtoB\x07\n\x05value\"5\n\x12OperatorSetIdProto\x12\x0e\n\x06\x64omain\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\x03*c\n\x07Version\x12\x12\n\x0e_START_VERSION\x10\x00\x12\x19\n\x15IR_VERSION_2017_10_10\x10\x01\x12\x19\n\x15IR_VERSION_2017_10_30\x10\x02\x12\x0e\n\nIR_VERSION\x10\x03') -) -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -_VERSION = _descriptor.EnumDescriptor( - name='Version', - full_name='onnx.Version', - filename=None, - file=DESCRIPTOR, - values=[ - _descriptor.EnumValueDescriptor( - name='_START_VERSION', index=0, number=0, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='IR_VERSION_2017_10_10', index=1, number=1, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='IR_VERSION_2017_10_30', index=2, number=2, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='IR_VERSION', index=3, number=3, - options=None, - type=None), - ], - containing_type=None, - options=None, - serialized_start=2214, - serialized_end=2313, -) -_sym_db.RegisterEnumDescriptor(_VERSION) - -Version = enum_type_wrapper.EnumTypeWrapper(_VERSION) -_START_VERSION = 0 -IR_VERSION_2017_10_10 = 1 -IR_VERSION_2017_10_30 = 2 -IR_VERSION = 3 - - -_ATTRIBUTEPROTO_ATTRIBUTETYPE = _descriptor.EnumDescriptor( - name='AttributeType', - full_name='onnx.AttributeProto.AttributeType', - filename=None, - file=DESCRIPTOR, - values=[ - _descriptor.EnumValueDescriptor( - name='UNDEFINED', index=0, number=0, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='FLOAT', index=1, number=1, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='INT', index=2, number=2, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='STRING', index=3, number=3, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='TENSOR', index=4, number=4, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='GRAPH', index=5, number=5, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='FLOATS', index=6, number=6, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='INTS', index=7, number=7, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='STRINGS', index=8, number=8, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='TENSORS', index=9, number=9, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='GRAPHS', index=10, number=10, - options=None, - type=None), - ], - containing_type=None, - options=None, - serialized_start=347, - serialized_end=492, -) -_sym_db.RegisterEnumDescriptor(_ATTRIBUTEPROTO_ATTRIBUTETYPE) - -_TENSORPROTO_DATATYPE = _descriptor.EnumDescriptor( - name='DataType', - full_name='onnx.TensorProto.DataType', - filename=None, - file=DESCRIPTOR, - values=[ - _descriptor.EnumValueDescriptor( - name='UNDEFINED', index=0, number=0, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='FLOAT', index=1, number=1, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='UINT8', index=2, number=2, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='INT8', index=3, number=3, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='UINT16', index=4, number=4, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='INT16', index=5, number=5, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='INT32', index=6, number=6, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='INT64', index=7, number=7, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='STRING', index=8, number=8, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='BOOL', index=9, number=9, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='FLOAT16', index=10, number=10, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='DOUBLE', index=11, number=11, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='UINT32', index=12, number=12, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='UINT64', index=13, number=13, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='COMPLEX64', index=14, number=14, - options=None, - type=None), - _descriptor.EnumValueDescriptor( - name='COMPLEX128', index=15, number=15, - options=None, - type=None), - ], - containing_type=None, - options=None, - serialized_start=1655, - serialized_end=1859, -) -_sym_db.RegisterEnumDescriptor(_TENSORPROTO_DATATYPE) - - -_ATTRIBUTEPROTO = _descriptor.Descriptor( - name='AttributeProto', - full_name='onnx.AttributeProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='onnx.AttributeProto.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='doc_string', full_name='onnx.AttributeProto.doc_string', index=1, - number=13, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='type', full_name='onnx.AttributeProto.type', index=2, - number=20, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='f', full_name='onnx.AttributeProto.f', index=3, - number=2, type=2, cpp_type=6, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='i', full_name='onnx.AttributeProto.i', index=4, - number=3, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='s', full_name='onnx.AttributeProto.s', index=5, - number=4, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='t', full_name='onnx.AttributeProto.t', index=6, - number=5, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='g', full_name='onnx.AttributeProto.g', index=7, - number=6, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='floats', full_name='onnx.AttributeProto.floats', index=8, - number=7, type=2, cpp_type=6, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='ints', full_name='onnx.AttributeProto.ints', index=9, - number=8, type=3, cpp_type=2, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='strings', full_name='onnx.AttributeProto.strings', index=10, - number=9, type=12, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='tensors', full_name='onnx.AttributeProto.tensors', index=11, - number=10, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='graphs', full_name='onnx.AttributeProto.graphs', index=12, - number=11, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - _ATTRIBUTEPROTO_ATTRIBUTETYPE, - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=35, - serialized_end=492, -) - - -_VALUEINFOPROTO = _descriptor.Descriptor( - name='ValueInfoProto', - full_name='onnx.ValueInfoProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='name', full_name='onnx.ValueInfoProto.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='type', full_name='onnx.ValueInfoProto.type', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='doc_string', full_name='onnx.ValueInfoProto.doc_string', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=494, - serialized_end=575, -) - - -_NODEPROTO = _descriptor.Descriptor( - name='NodeProto', - full_name='onnx.NodeProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='input', full_name='onnx.NodeProto.input', index=0, - number=1, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='output', full_name='onnx.NodeProto.output', index=1, - number=2, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='name', full_name='onnx.NodeProto.name', index=2, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='op_type', full_name='onnx.NodeProto.op_type', index=3, - number=4, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='domain', full_name='onnx.NodeProto.domain', index=4, - number=7, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='attribute', full_name='onnx.NodeProto.attribute', index=5, - number=5, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='doc_string', full_name='onnx.NodeProto.doc_string', index=6, - number=6, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=578, - serialized_end=728, -) - - -_MODELPROTO = _descriptor.Descriptor( - name='ModelProto', - full_name='onnx.ModelProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='ir_version', full_name='onnx.ModelProto.ir_version', index=0, - number=1, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='opset_import', full_name='onnx.ModelProto.opset_import', index=1, - number=8, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='producer_name', full_name='onnx.ModelProto.producer_name', index=2, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='producer_version', full_name='onnx.ModelProto.producer_version', index=3, - number=3, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='domain', full_name='onnx.ModelProto.domain', index=4, - number=4, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='model_version', full_name='onnx.ModelProto.model_version', index=5, - number=5, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='doc_string', full_name='onnx.ModelProto.doc_string', index=6, - number=6, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='graph', full_name='onnx.ModelProto.graph', index=7, - number=7, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='metadata_props', full_name='onnx.ModelProto.metadata_props', index=8, - number=14, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=731, - serialized_end=1006, -) - - -_STRINGSTRINGENTRYPROTO = _descriptor.Descriptor( - name='StringStringEntryProto', - full_name='onnx.StringStringEntryProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='key', full_name='onnx.StringStringEntryProto.key', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='value', full_name='onnx.StringStringEntryProto.value', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=1008, - serialized_end=1060, -) - - -_GRAPHPROTO = _descriptor.Descriptor( - name='GraphProto', - full_name='onnx.GraphProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='node', full_name='onnx.GraphProto.node', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='name', full_name='onnx.GraphProto.name', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='initializer', full_name='onnx.GraphProto.initializer', index=2, - number=5, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='doc_string', full_name='onnx.GraphProto.doc_string', index=3, - number=10, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='input', full_name='onnx.GraphProto.input', index=4, - number=11, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='output', full_name='onnx.GraphProto.output', index=5, - number=12, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='value_info', full_name='onnx.GraphProto.value_info', index=6, - number=13, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=1063, - serialized_end=1297, -) - - -_TENSORPROTO_SEGMENT = _descriptor.Descriptor( - name='Segment', - full_name='onnx.TensorProto.Segment', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='begin', full_name='onnx.TensorProto.Segment.begin', index=0, - number=1, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='end', full_name='onnx.TensorProto.Segment.end', index=1, - number=2, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=1615, - serialized_end=1652, -) - -_TENSORPROTO = _descriptor.Descriptor( - name='TensorProto', - full_name='onnx.TensorProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='dims', full_name='onnx.TensorProto.dims', index=0, - number=1, type=3, cpp_type=2, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='data_type', full_name='onnx.TensorProto.data_type', index=1, - number=2, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='segment', full_name='onnx.TensorProto.segment', index=2, - number=3, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='float_data', full_name='onnx.TensorProto.float_data', index=3, - number=4, type=2, cpp_type=6, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001'))), - _descriptor.FieldDescriptor( - name='int32_data', full_name='onnx.TensorProto.int32_data', index=4, - number=5, type=5, cpp_type=1, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001'))), - _descriptor.FieldDescriptor( - name='string_data', full_name='onnx.TensorProto.string_data', index=5, - number=6, type=12, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='int64_data', full_name='onnx.TensorProto.int64_data', index=6, - number=7, type=3, cpp_type=2, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001'))), - _descriptor.FieldDescriptor( - name='name', full_name='onnx.TensorProto.name', index=7, - number=8, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='doc_string', full_name='onnx.TensorProto.doc_string', index=8, - number=12, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='raw_data', full_name='onnx.TensorProto.raw_data', index=9, - number=9, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='double_data', full_name='onnx.TensorProto.double_data', index=10, - number=10, type=1, cpp_type=5, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001'))), - _descriptor.FieldDescriptor( - name='uint64_data', full_name='onnx.TensorProto.uint64_data', index=11, - number=11, type=4, cpp_type=4, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=_descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001'))), - ], - extensions=[ - ], - nested_types=[_TENSORPROTO_SEGMENT, ], - enum_types=[ - _TENSORPROTO_DATATYPE, - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=1300, - serialized_end=1859, -) - - -_TENSORSHAPEPROTO_DIMENSION = _descriptor.Descriptor( - name='Dimension', - full_name='onnx.TensorShapeProto.Dimension', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='dim_value', full_name='onnx.TensorShapeProto.Dimension.dim_value', index=0, - number=1, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='dim_param', full_name='onnx.TensorShapeProto.Dimension.dim_param', index=1, - number=2, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='value', full_name='onnx.TensorShapeProto.Dimension.value', - index=0, containing_type=None, fields=[]), - ], - serialized_start=1929, - serialized_end=1991, -) - -_TENSORSHAPEPROTO = _descriptor.Descriptor( - name='TensorShapeProto', - full_name='onnx.TensorShapeProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='dim', full_name='onnx.TensorShapeProto.dim', index=0, - number=1, type=11, cpp_type=10, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[_TENSORSHAPEPROTO_DIMENSION, ], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=1862, - serialized_end=1991, -) - - -_TYPEPROTO_TENSOR = _descriptor.Descriptor( - name='Tensor', - full_name='onnx.TypeProto.Tensor', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='elem_type', full_name='onnx.TypeProto.Tensor.elem_type', index=0, - number=1, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='shape', full_name='onnx.TypeProto.Tensor.shape', index=1, - number=2, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=2054, - serialized_end=2148, -) - -_TYPEPROTO = _descriptor.Descriptor( - name='TypeProto', - full_name='onnx.TypeProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='tensor_type', full_name='onnx.TypeProto.tensor_type', index=0, - number=1, type=11, cpp_type=10, label=1, - has_default_value=False, default_value=None, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[_TYPEPROTO_TENSOR, ], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name='value', full_name='onnx.TypeProto.value', - index=0, containing_type=None, fields=[]), - ], - serialized_start=1994, - serialized_end=2157, -) - - -_OPERATORSETIDPROTO = _descriptor.Descriptor( - name='OperatorSetIdProto', - full_name='onnx.OperatorSetIdProto', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='domain', full_name='onnx.OperatorSetIdProto.domain', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='version', full_name='onnx.OperatorSetIdProto.version', index=1, - number=2, type=3, cpp_type=2, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - extension_ranges=[], - oneofs=[ - ], - serialized_start=2159, - serialized_end=2212, -) - -_ATTRIBUTEPROTO.fields_by_name['type'].enum_type = _ATTRIBUTEPROTO_ATTRIBUTETYPE -_ATTRIBUTEPROTO.fields_by_name['t'].message_type = _TENSORPROTO -_ATTRIBUTEPROTO.fields_by_name['g'].message_type = _GRAPHPROTO -_ATTRIBUTEPROTO.fields_by_name['tensors'].message_type = _TENSORPROTO -_ATTRIBUTEPROTO.fields_by_name['graphs'].message_type = _GRAPHPROTO -_ATTRIBUTEPROTO_ATTRIBUTETYPE.containing_type = _ATTRIBUTEPROTO -_VALUEINFOPROTO.fields_by_name['type'].message_type = _TYPEPROTO -_NODEPROTO.fields_by_name['attribute'].message_type = _ATTRIBUTEPROTO -_MODELPROTO.fields_by_name['opset_import'].message_type = _OPERATORSETIDPROTO -_MODELPROTO.fields_by_name['graph'].message_type = _GRAPHPROTO -_MODELPROTO.fields_by_name['metadata_props'].message_type = _STRINGSTRINGENTRYPROTO -_GRAPHPROTO.fields_by_name['node'].message_type = _NODEPROTO -_GRAPHPROTO.fields_by_name['initializer'].message_type = _TENSORPROTO -_GRAPHPROTO.fields_by_name['input'].message_type = _VALUEINFOPROTO -_GRAPHPROTO.fields_by_name['output'].message_type = _VALUEINFOPROTO -_GRAPHPROTO.fields_by_name['value_info'].message_type = _VALUEINFOPROTO -_TENSORPROTO_SEGMENT.containing_type = _TENSORPROTO -_TENSORPROTO.fields_by_name['data_type'].enum_type = _TENSORPROTO_DATATYPE -_TENSORPROTO.fields_by_name['segment'].message_type = _TENSORPROTO_SEGMENT -_TENSORPROTO_DATATYPE.containing_type = _TENSORPROTO -_TENSORSHAPEPROTO_DIMENSION.containing_type = _TENSORSHAPEPROTO -_TENSORSHAPEPROTO_DIMENSION.oneofs_by_name['value'].fields.append( - _TENSORSHAPEPROTO_DIMENSION.fields_by_name['dim_value']) -_TENSORSHAPEPROTO_DIMENSION.fields_by_name['dim_value'].containing_oneof = _TENSORSHAPEPROTO_DIMENSION.oneofs_by_name['value'] -_TENSORSHAPEPROTO_DIMENSION.oneofs_by_name['value'].fields.append( - _TENSORSHAPEPROTO_DIMENSION.fields_by_name['dim_param']) -_TENSORSHAPEPROTO_DIMENSION.fields_by_name['dim_param'].containing_oneof = _TENSORSHAPEPROTO_DIMENSION.oneofs_by_name['value'] -_TENSORSHAPEPROTO.fields_by_name['dim'].message_type = _TENSORSHAPEPROTO_DIMENSION -_TYPEPROTO_TENSOR.fields_by_name['elem_type'].enum_type = _TENSORPROTO_DATATYPE -_TYPEPROTO_TENSOR.fields_by_name['shape'].message_type = _TENSORSHAPEPROTO -_TYPEPROTO_TENSOR.containing_type = _TYPEPROTO -_TYPEPROTO.fields_by_name['tensor_type'].message_type = _TYPEPROTO_TENSOR -_TYPEPROTO.oneofs_by_name['value'].fields.append( - _TYPEPROTO.fields_by_name['tensor_type']) -_TYPEPROTO.fields_by_name['tensor_type'].containing_oneof = _TYPEPROTO.oneofs_by_name['value'] -DESCRIPTOR.message_types_by_name['AttributeProto'] = _ATTRIBUTEPROTO -DESCRIPTOR.message_types_by_name['ValueInfoProto'] = _VALUEINFOPROTO -DESCRIPTOR.message_types_by_name['NodeProto'] = _NODEPROTO -DESCRIPTOR.message_types_by_name['ModelProto'] = _MODELPROTO -DESCRIPTOR.message_types_by_name['StringStringEntryProto'] = _STRINGSTRINGENTRYPROTO -DESCRIPTOR.message_types_by_name['GraphProto'] = _GRAPHPROTO -DESCRIPTOR.message_types_by_name['TensorProto'] = _TENSORPROTO -DESCRIPTOR.message_types_by_name['TensorShapeProto'] = _TENSORSHAPEPROTO -DESCRIPTOR.message_types_by_name['TypeProto'] = _TYPEPROTO -DESCRIPTOR.message_types_by_name['OperatorSetIdProto'] = _OPERATORSETIDPROTO -DESCRIPTOR.enum_types_by_name['Version'] = _VERSION - -AttributeProto = _reflection.GeneratedProtocolMessageType('AttributeProto', (_message.Message,), dict( - DESCRIPTOR = _ATTRIBUTEPROTO, - __module__ = 'visualdl.onnx.onnx_pb2' - # @@protoc_insertion_point(class_scope:onnx.AttributeProto) - )) -_sym_db.RegisterMessage(AttributeProto) - -ValueInfoProto = _reflection.GeneratedProtocolMessageType('ValueInfoProto', (_message.Message,), dict( - DESCRIPTOR = _VALUEINFOPROTO, - __module__ = 'visualdl.onnx.onnx_pb2' - # @@protoc_insertion_point(class_scope:onnx.ValueInfoProto) - )) -_sym_db.RegisterMessage(ValueInfoProto) - -NodeProto = _reflection.GeneratedProtocolMessageType('NodeProto', (_message.Message,), dict( - DESCRIPTOR = _NODEPROTO, - __module__ = 'visualdl.onnx.onnx_pb2' - # @@protoc_insertion_point(class_scope:onnx.NodeProto) - )) -_sym_db.RegisterMessage(NodeProto) - -ModelProto = _reflection.GeneratedProtocolMessageType('ModelProto', (_message.Message,), dict( - DESCRIPTOR = _MODELPROTO, - __module__ = 'visualdl.onnx.onnx_pb2' - # @@protoc_insertion_point(class_scope:onnx.ModelProto) - )) -_sym_db.RegisterMessage(ModelProto) - -StringStringEntryProto = _reflection.GeneratedProtocolMessageType('StringStringEntryProto', (_message.Message,), dict( - DESCRIPTOR = _STRINGSTRINGENTRYPROTO, - __module__ = 'visualdl.onnx.onnx_pb2' - # @@protoc_insertion_point(class_scope:onnx.StringStringEntryProto) - )) -_sym_db.RegisterMessage(StringStringEntryProto) - -GraphProto = _reflection.GeneratedProtocolMessageType('GraphProto', (_message.Message,), dict( - DESCRIPTOR = _GRAPHPROTO, - __module__ = 'visualdl.onnx.onnx_pb2' - # @@protoc_insertion_point(class_scope:onnx.GraphProto) - )) -_sym_db.RegisterMessage(GraphProto) - -TensorProto = _reflection.GeneratedProtocolMessageType('TensorProto', (_message.Message,), dict( - - Segment = _reflection.GeneratedProtocolMessageType('Segment', (_message.Message,), dict( - DESCRIPTOR = _TENSORPROTO_SEGMENT, - __module__ = 'visualdl.onnx.onnx_pb2' - # @@protoc_insertion_point(class_scope:onnx.TensorProto.Segment) - )) - , - DESCRIPTOR = _TENSORPROTO, - __module__ = 'visualdl.onnx.onnx_pb2' - # @@protoc_insertion_point(class_scope:onnx.TensorProto) - )) -_sym_db.RegisterMessage(TensorProto) -_sym_db.RegisterMessage(TensorProto.Segment) - -TensorShapeProto = _reflection.GeneratedProtocolMessageType('TensorShapeProto', (_message.Message,), dict( - - Dimension = _reflection.GeneratedProtocolMessageType('Dimension', (_message.Message,), dict( - DESCRIPTOR = _TENSORSHAPEPROTO_DIMENSION, - __module__ = 'visualdl.onnx.onnx_pb2' - # @@protoc_insertion_point(class_scope:onnx.TensorShapeProto.Dimension) - )) - , - DESCRIPTOR = _TENSORSHAPEPROTO, - __module__ = 'visualdl.onnx.onnx_pb2' - # @@protoc_insertion_point(class_scope:onnx.TensorShapeProto) - )) -_sym_db.RegisterMessage(TensorShapeProto) -_sym_db.RegisterMessage(TensorShapeProto.Dimension) - -TypeProto = _reflection.GeneratedProtocolMessageType('TypeProto', (_message.Message,), dict( - - Tensor = _reflection.GeneratedProtocolMessageType('Tensor', (_message.Message,), dict( - DESCRIPTOR = _TYPEPROTO_TENSOR, - __module__ = 'visualdl.onnx.onnx_pb2' - # @@protoc_insertion_point(class_scope:onnx.TypeProto.Tensor) - )) - , - DESCRIPTOR = _TYPEPROTO, - __module__ = 'visualdl.onnx.onnx_pb2' - # @@protoc_insertion_point(class_scope:onnx.TypeProto) - )) -_sym_db.RegisterMessage(TypeProto) -_sym_db.RegisterMessage(TypeProto.Tensor) - -OperatorSetIdProto = _reflection.GeneratedProtocolMessageType('OperatorSetIdProto', (_message.Message,), dict( - DESCRIPTOR = _OPERATORSETIDPROTO, - __module__ = 'visualdl.onnx.onnx_pb2' - # @@protoc_insertion_point(class_scope:onnx.OperatorSetIdProto) - )) -_sym_db.RegisterMessage(OperatorSetIdProto) - - -_TENSORPROTO.fields_by_name['float_data'].has_options = True -_TENSORPROTO.fields_by_name['float_data']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001')) -_TENSORPROTO.fields_by_name['int32_data'].has_options = True -_TENSORPROTO.fields_by_name['int32_data']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001')) -_TENSORPROTO.fields_by_name['int64_data'].has_options = True -_TENSORPROTO.fields_by_name['int64_data']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001')) -_TENSORPROTO.fields_by_name['double_data'].has_options = True -_TENSORPROTO.fields_by_name['double_data']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001')) -_TENSORPROTO.fields_by_name['uint64_data'].has_options = True -_TENSORPROTO.fields_by_name['uint64_data']._options = _descriptor._ParseOptions(descriptor_pb2.FieldOptions(), _b('\020\001')) -# @@protoc_insertion_point(module_scope) From ea4fcc44fcf51fbd889b407338581fbf36d4edd9 Mon Sep 17 00:00:00 2001 From: superjom Date: Mon, 8 Jan 2018 11:38:28 +0800 Subject: [PATCH 11/23] fix server_test --- build.sh | 21 +++++---------------- tests.sh | 21 ++++++++------------- visualdl/__init__.py | 2 ++ visualdl/python/storage.py | 2 -- visualdl/python/test_storage.py | 17 ++++++++++------- 5 files changed, 25 insertions(+), 38 deletions(-) diff --git a/build.sh b/build.sh index b1978b4d6..b33f9ca0b 100644 --- a/build.sh +++ b/build.sh @@ -10,8 +10,10 @@ mkdir -p $BUILD_DIR build_frontend() { cd $FRONTEND_DIR - npm install - npm run build + if [ ! -d "dist" ]; then + npm install + npm run build + fi } build_backend() { @@ -31,20 +33,7 @@ package() { cp $BUILD_DIR/visualdl/logic/core.so $TOP_DIR/visualdl/python/ } -# package() { -# cd $TOP_DIR -# mkdir -p pip_package/visualdl -# cd pip_package -# touch __init__.py -# cd visualdl -# touch __init__.py - -# cp -rf $BACKEND_DIR/python/*.py . -# cp -rf $BACKEND_DIR/server . -# cp $BUILD_DIR/visualdl/logic/core.so . -# } - -#build_frontend +build_frontend build_backend build_onnx_graph package diff --git a/tests.sh b/tests.sh index aeb3cf742..bb9501b02 100644 --- a/tests.sh +++ b/tests.sh @@ -31,19 +31,10 @@ server_test() { sudo pip install google sudo pip install protobuf==3.1.0 - cd $cur/server - curl -OL https://github.com/google/protobuf/releases/download/v3.1.0/protoc-3.1.0-linux-x86_64.zip - unzip protoc-3.1.0-linux-x86_64.zip -d protoc3 - export PATH=$PATH:protoc3/bin - sudo chmod +x protoc3/bin/protoc - sudo chown `whoami` protoc3/bin/protoc - - bash build.sh - - cd visualdl + cd $cur/visualdl/server bash graph_test.sh - cd $cur/server/visualdl + cd $cur/visualdl/server python lib_test.py } @@ -52,8 +43,8 @@ server_test() { bigfile_reject() { cd $cur # it failed to exclude .git, remove it first. - rm -rf .git - local largest_file=$(find . -path .git -prune -o -printf '%s %p\n' | sort -nr | head -n1) + #rm -rf .git + local largest_file="$(find . -path .git -prune -not -name ".*" -o -printf '%s %p\n' | sort -nr | head -n1)" local size=$(echo $largest_file | awk '{print $1}') if [ "$size" -ge "$max_file_size" ]; then echo $largest_file @@ -72,6 +63,10 @@ elif [ $mode = "all" ]; then frontend_test backend_test server_test +elif [ $mode = "local" ]; then + #frontend_test + backend_test + server_test else frontend_test fi diff --git a/visualdl/__init__.py b/visualdl/__init__.py index c3961685a..31b48f729 100644 --- a/visualdl/__init__.py +++ b/visualdl/__init__.py @@ -1 +1,3 @@ from __future__ import absolute_import + +from .python.storage import * diff --git a/visualdl/python/storage.py b/visualdl/python/storage.py index 7a5ee182b..311a7bf14 100644 --- a/visualdl/python/storage.py +++ b/visualdl/python/storage.py @@ -1,7 +1,5 @@ from __future__ import absolute_import -import visualdl - from visualdl import core dtypes = ("float", "double", "int32", "int64") diff --git a/visualdl/python/test_storage.py b/visualdl/python/test_storage.py index d766c3445..7ca7c853e 100644 --- a/visualdl/python/test_storage.py +++ b/visualdl/python/test_storage.py @@ -5,13 +5,16 @@ import numpy as np from PIL import Image -import storage +import sys, pprint +pprint.pprint(sys.path) + +from visualdl import LogWriter, LogReader class StorageTest(unittest.TestCase): def setUp(self): self.dir = "./tmp/storage_test" - self.writer = storage.LogWriter( + self.writer = LogWriter( self.dir, sync_cycle=1).as_mode("train") def test_scalar(self): @@ -22,7 +25,7 @@ def test_scalar(self): scalar.add_record(i, float(i)) print 'test read' - self.reader = storage.LogReader(self.dir) + self.reader = LogReader(self.dir) with self.reader.mode("train") as reader: scalar = reader.scalar("model/scalar/min") self.assertEqual(scalar.caption(), "train") @@ -50,7 +53,7 @@ def test_image(self): image_writer.set_sample(index, shape, list(data)) image_writer.finish_sampling() - self.reader = storage.LogReader(self.dir) + self.reader = LogReader(self.dir) with self.reader.mode("train") as reader: image_reader = reader.image(tag) self.assertEqual(image_reader.caption(), tag) @@ -77,7 +80,7 @@ def test_check_image(self): shape = [image.size[1], image.size[0], 3] origin_data = np.array(image.getdata()).flatten() - self.reader = storage.LogReader(self.dir) + self.reader = LogReader(self.dir) with self.reader.mode("train") as reader: image_writer.start_sampling() @@ -110,14 +113,14 @@ def test_with_syntax(self): for i in range(10): scalar.add_record(i, float(i)) - self.reader = storage.LogReader(self.dir) + self.reader = LogReader(self.dir) with self.reader.mode("train") as reader: scalar = reader.scalar("model/scalar/average") self.assertEqual(scalar.caption(), "train") def test_modes(self): dir = "./tmp/storagetest0" - store = storage.LogWriter( + store = LogWriter( self.dir, sync_cycle=1) scalars = [] From e0c05acd4951d53f785db6c646de3365b63a51f5 Mon Sep 17 00:00:00 2001 From: superjom Date: Mon, 8 Jan 2018 11:48:35 +0800 Subject: [PATCH 12/23] add package into tests.sh --- tests.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests.sh b/tests.sh index bb9501b02..c12937587 100644 --- a/tests.sh +++ b/tests.sh @@ -9,6 +9,13 @@ readonly max_file_size=1000000 # 1MB export PYTHONPATH="${core_path}:${python_path}" +# install the visualdl wheel first +package() { + cd $cur + python setup.py bdist_wheel + sudo pip install dist/visualdl-0.0.1-py2-none-any.whl +} + backend_test() { cd $cur sudo pip install numpy @@ -59,6 +66,7 @@ echo "mode" $mode if [ $mode = "backend" ]; then backend_test elif [ $mode = "all" ]; then + package bigfile_reject frontend_test backend_test From 66a1ae62aab3e02d7d873d5737758a1a205d94a2 Mon Sep 17 00:00:00 2001 From: superjom Date: Mon, 8 Jan 2018 11:51:15 +0800 Subject: [PATCH 13/23] add protobuf-compiler for package --- tests.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests.sh b/tests.sh index c12937587..eaebf2918 100644 --- a/tests.sh +++ b/tests.sh @@ -11,6 +11,7 @@ export PYTHONPATH="${core_path}:${python_path}" # install the visualdl wheel first package() { + sudo apt-get install protobuf-compiler cd $cur python setup.py bdist_wheel sudo pip install dist/visualdl-0.0.1-py2-none-any.whl From 596b244ac268bcf8c24e6864954af0577b884722 Mon Sep 17 00:00:00 2001 From: superjom Date: Mon, 8 Jan 2018 11:51:46 +0800 Subject: [PATCH 14/23] recover .git --- tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests.sh b/tests.sh index eaebf2918..b22f53b58 100644 --- a/tests.sh +++ b/tests.sh @@ -51,8 +51,8 @@ server_test() { bigfile_reject() { cd $cur # it failed to exclude .git, remove it first. - #rm -rf .git - local largest_file="$(find . -path .git -prune -not -name ".*" -o -printf '%s %p\n' | sort -nr | head -n1)" + rm -rf .git + local largest_file="$(find . -path .git -prune -o -printf '%s %p\n' | sort -nr | head -n1)" local size=$(echo $largest_file | awk '{print $1}') if [ "$size" -ge "$max_file_size" ]; then echo $largest_file From 248fc1f457d6bbb0593f55a3056f59df34c8953c Mon Sep 17 00:00:00 2001 From: superjom Date: Mon, 8 Jan 2018 11:54:52 +0800 Subject: [PATCH 15/23] change script bin visualdl_bin to visualDL --- setup.py | 2 +- visualdl/server/{visualdl_bin => visualDL} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename visualdl/server/{visualdl_bin => visualDL} (100%) diff --git a/setup.py b/setup.py index 177bf658c..ccfb78d5e 100644 --- a/setup.py +++ b/setup.py @@ -84,6 +84,6 @@ def run(self): 'visualdl':['core.so'], 'visualdl.python':['core.so']}, packages=packages, - scripts=['visualdl/server/visualdl_bin'], + scripts=['visualdl/server/visualDL'], # include_package_data=True, cmdclass=cmdclass) diff --git a/visualdl/server/visualdl_bin b/visualdl/server/visualDL similarity index 100% rename from visualdl/server/visualdl_bin rename to visualdl/server/visualDL From e09e8d9e149213bc92ddd29607716f83ed8e065e Mon Sep 17 00:00:00 2001 From: superjom Date: Mon, 8 Jan 2018 12:30:11 +0800 Subject: [PATCH 16/23] add npm cache --- .travis.yml | 1 + README.md | 28 ++++------------------------ setup.py | 1 - visualdl/server/visualDL | 4 ++++ 4 files changed, 9 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 25b902d3b..354be9f5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ cache: - pip - ccache - yarn + - npm sudo: required dist: trusty os: diff --git a/README.md b/README.md index 37cdaed11..3eb2d5c23 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,14 @@ # VisualDL -### How to use -#### Step 1: build frontend -```shell -cd frontend -npm install -npm run build +### How to install ``` - -this step will generate a dist directory under frontend - -### Step 2: copy frontend/dist to server/visualdl/frontend/dist -```shell -mkdir -p server/visualdl/frontend/dist -cp -r frontend/dist server/visualdl/frontend/dist -``` - -#### Step 3: build and install Python package -```shell -cd server/ -sh build.sh -cd dist -sudo pip install --upgrade visualdl-0.0.1-py2-none-any.whl +python setup.py bdist_wheel +pip install --upgrade dist/visualdl-0.0.1-py2-none-any.whl ``` ### Step 3: run ``` -# cd to visualdl install dir -cd /usr/local/lib/python2.7/site-packages/visualdl/ -python visual_dl.py --port=8888 +visualDL --logdir= --port=8888 ``` diff --git a/setup.py b/setup.py index ccfb78d5e..0f7b79190 100644 --- a/setup.py +++ b/setup.py @@ -85,5 +85,4 @@ def run(self): 'visualdl.python':['core.so']}, packages=packages, scripts=['visualdl/server/visualDL'], - # include_package_data=True, cmdclass=cmdclass) diff --git a/visualdl/server/visualDL b/visualdl/server/visualDL index d8642cd4d..5d21b2347 100644 --- a/visualdl/server/visualDL +++ b/visualdl/server/visualDL @@ -182,4 +182,8 @@ def graph(): if __name__ == '__main__': logger.info(" port=" + str(options.port)) + if not options.logdir: + logger.error("should pass in logdir option") + sys.exit(-1) + app.run(debug=False, host=options.host, port=options.port) From 26ab42a7e6123d875368728529b4c5e34ae71e94 Mon Sep 17 00:00:00 2001 From: superjom Date: Mon, 8 Jan 2018 12:53:03 +0800 Subject: [PATCH 17/23] avoid build_frontend in travis-CI --- build.sh | 15 ++++++++++++++- setup.py | 6 +++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index b33f9ca0b..ea05d2659 100644 --- a/build.sh +++ b/build.sh @@ -16,6 +16,11 @@ build_frontend() { fi } +build_frontend_fake() { + cd $FRONTEND_DIR + mkdir -p dist +} + build_backend() { cd $BUILD_DIR cmake .. @@ -33,7 +38,15 @@ package() { cp $BUILD_DIR/visualdl/logic/core.so $TOP_DIR/visualdl/python/ } -build_frontend +ARG=$1 + + +if [ $ARG = "travis-CI" ]; then + build_frontend_fake +else + build_frontend +fi + build_backend build_onnx_graph package diff --git a/setup.py b/setup.py index 0f7b79190..1ad4b0bd9 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,7 @@ TOP_DIR = os.path.realpath(os.path.dirname(__file__)) PYTHON_SDK_DIR = os.path.join(TOP_DIR, 'visualdl/python') BUILD_DIR = os.path.join(TOP_DIR, 'build') +MODE = os.environ.get('MODE', 'RELEASE') def read(name): @@ -55,7 +56,10 @@ def finalize_options(self): class build_py(setuptools.command.build_py.build_py): def run(self): - subprocess.check_call(['bash', 'build.sh']) + cmd = ['bash', 'build.sh'] + if MODE == "travis-CI": + cmd.append('travis-CI') + subprocess.check_call(cmd) return setuptools.command.build_py.build_py.run(self) From 08cd22fe104aaad052e38428b83eb77f813a2134 Mon Sep 17 00:00:00 2001 From: superjom Date: Mon, 8 Jan 2018 12:57:48 +0800 Subject: [PATCH 18/23] avoid frontend build in travis-CI --- build.sh | 1 + setup.py | 2 +- tests.sh | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index ea05d2659..ca790376e 100644 --- a/build.sh +++ b/build.sh @@ -39,6 +39,7 @@ package() { } ARG=$1 +echo "ARG: " $ARG if [ $ARG = "travis-CI" ]; then diff --git a/setup.py b/setup.py index 1ad4b0bd9..0633a1971 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ TOP_DIR = os.path.realpath(os.path.dirname(__file__)) PYTHON_SDK_DIR = os.path.join(TOP_DIR, 'visualdl/python') BUILD_DIR = os.path.join(TOP_DIR, 'build') -MODE = os.environ.get('MODE', 'RELEASE') +MODE = os.environ.get('VS_BUILD_MODE', 'RELEASE') def read(name): diff --git a/tests.sh b/tests.sh index b22f53b58..be0df4fd8 100644 --- a/tests.sh +++ b/tests.sh @@ -11,6 +11,10 @@ export PYTHONPATH="${core_path}:${python_path}" # install the visualdl wheel first package() { + # some bug with frontend build + # a environment variable to skip frontend build + export VS_BUILD_MODE="travis-CI" + sudo apt-get install protobuf-compiler cd $cur python setup.py bdist_wheel From 545c7ef74b02c2278aecfcbee987044f8dbaa2e4 Mon Sep 17 00:00:00 2001 From: superjom Date: Mon, 8 Jan 2018 13:06:54 +0800 Subject: [PATCH 19/23] add pips --- tests.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests.sh b/tests.sh index be0df4fd8..f33c76a2d 100644 --- a/tests.sh +++ b/tests.sh @@ -15,6 +15,11 @@ package() { # a environment variable to skip frontend build export VS_BUILD_MODE="travis-CI" + sudo pip install numpy + sudo pip install Flask + sudo pip install Pillow + sudo pip install protobuf + sudo apt-get install protobuf-compiler cd $cur python setup.py bdist_wheel From 995c85d3f0645f148bb3a9786d520d2098a00000 Mon Sep 17 00:00:00 2001 From: superjom Date: Mon, 8 Jan 2018 13:29:59 +0800 Subject: [PATCH 20/23] restore protobuf mannul installation --- build.sh | 7 +++++++ tests.sh | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index ca790376e..0f1ef0437 100644 --- a/build.sh +++ b/build.sh @@ -28,6 +28,13 @@ build_backend() { } build_onnx_graph() { + cd $TOP_DIR/visualdl/server + # manully install protobuf3 + curl -OL https://github.com/google/protobuf/releases/download/v3.1.0/protoc-3.1.0-linux-x86_64.zip + unzip protoc-3.1.0-linux-x86_64.zip -d protoc3 + export PATH="$PATH:$(pwd)/protoc3/bin" + chmod +x protoc3/bin/* + cd $TOP_DIR/visualdl/server/onnx protoc onnx.proto --python_out . } diff --git a/tests.sh b/tests.sh index f33c76a2d..4a57fa3fa 100644 --- a/tests.sh +++ b/tests.sh @@ -20,7 +20,7 @@ package() { sudo pip install Pillow sudo pip install protobuf - sudo apt-get install protobuf-compiler + #sudo apt-get install protobuf-compiler cd $cur python setup.py bdist_wheel sudo pip install dist/visualdl-0.0.1-py2-none-any.whl From ab081678e7393598c4dae86b32b33121d6c02ee0 Mon Sep 17 00:00:00 2001 From: superjom Date: Mon, 8 Jan 2018 13:36:39 +0800 Subject: [PATCH 21/23] install protobuf --- build.sh | 7 ------- tests.sh | 25 ++++++++++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/build.sh b/build.sh index 0f1ef0437..ca790376e 100644 --- a/build.sh +++ b/build.sh @@ -28,13 +28,6 @@ build_backend() { } build_onnx_graph() { - cd $TOP_DIR/visualdl/server - # manully install protobuf3 - curl -OL https://github.com/google/protobuf/releases/download/v3.1.0/protoc-3.1.0-linux-x86_64.zip - unzip protoc-3.1.0-linux-x86_64.zip -d protoc3 - export PATH="$PATH:$(pwd)/protoc3/bin" - chmod +x protoc3/bin/* - cd $TOP_DIR/visualdl/server/onnx protoc onnx.proto --python_out . } diff --git a/tests.sh b/tests.sh index 4a57fa3fa..cfe236024 100644 --- a/tests.sh +++ b/tests.sh @@ -2,9 +2,9 @@ set -ex mode=$1 -readonly cur=$(pwd) -readonly core_path=$cur/build/visualdl/logic -readonly python_path=$cur/visualdl/python +readonly TOP_DIR=$(pwd) +readonly core_path=$TOP_DIR/build/visualdl/logic +readonly python_path=$TOP_DIR/visualdl/python readonly max_file_size=1000000 # 1MB export PYTHONPATH="${core_path}:${python_path}" @@ -15,19 +15,26 @@ package() { # a environment variable to skip frontend build export VS_BUILD_MODE="travis-CI" + cd $TOP_DIR/visualdl/server + # manully install protobuf3 + curl -OL https://github.com/google/protobuf/releases/download/v3.1.0/protoc-3.1.0-linux-x86_64.zip + unzip protoc-3.1.0-linux-x86_64.zip -d protoc3 + export PATH="$PATH:$(pwd)/protoc3/bin" + chmod +x protoc3/bin/* + sudo pip install numpy sudo pip install Flask sudo pip install Pillow sudo pip install protobuf #sudo apt-get install protobuf-compiler - cd $cur + cd $TOP_DIR python setup.py bdist_wheel sudo pip install dist/visualdl-0.0.1-py2-none-any.whl } backend_test() { - cd $cur + cd $TOP_DIR sudo pip install numpy sudo pip install Pillow mkdir -p build @@ -38,7 +45,7 @@ backend_test() { } frontend_test() { - cd $cur + cd $TOP_DIR cd frontend npm install npm run build @@ -48,17 +55,17 @@ server_test() { sudo pip install google sudo pip install protobuf==3.1.0 - cd $cur/visualdl/server + cd $TOP_DIR/visualdl/server bash graph_test.sh - cd $cur/visualdl/server + cd $TOP_DIR/visualdl/server python lib_test.py } # check the size of files in the repo. # reject PR that has some big data included. bigfile_reject() { - cd $cur + cd $TOP_DIR # it failed to exclude .git, remove it first. rm -rf .git local largest_file="$(find . -path .git -prune -o -printf '%s %p\n' | sort -nr | head -n1)" From c39865780649e2f30e0954a866f918a4786db99c Mon Sep 17 00:00:00 2001 From: superjom Date: Mon, 8 Jan 2018 14:02:05 +0800 Subject: [PATCH 22/23] fix package --- build.sh | 1 + tests.sh | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index ca790376e..bce383961 100644 --- a/build.sh +++ b/build.sh @@ -28,6 +28,7 @@ build_backend() { } build_onnx_graph() { + # TODO(ChunweiYan) check protoc version here cd $TOP_DIR/visualdl/server/onnx protoc onnx.proto --python_out . } diff --git a/tests.sh b/tests.sh index cfe236024..8b29d62e1 100644 --- a/tests.sh +++ b/tests.sh @@ -83,8 +83,9 @@ echo "mode" $mode if [ $mode = "backend" ]; then backend_test elif [ $mode = "all" ]; then - package + # bigfile_reject should be tested first, or some files downloaded may fail this test. bigfile_reject + package frontend_test backend_test server_test From be50d63db1cdc250c4534257543be5890b057745 Mon Sep 17 00:00:00 2001 From: superjom Date: Mon, 8 Jan 2018 15:10:51 +0800 Subject: [PATCH 23/23] fix tool --- visualdl/__init__.py | 4 ++++ visualdl/server/visualDL | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/visualdl/__init__.py b/visualdl/__init__.py index 31b48f729..d253f9e4a 100644 --- a/visualdl/__init__.py +++ b/visualdl/__init__.py @@ -1,3 +1,7 @@ from __future__ import absolute_import +import os + from .python.storage import * + +ROOT = os.path.dirname(__file__) diff --git a/visualdl/server/visualDL b/visualdl/server/visualDL index 5d21b2347..675c5d0ba 100644 --- a/visualdl/server/visualDL +++ b/visualdl/server/visualDL @@ -9,19 +9,19 @@ from optparse import OptionParser from flask import (Flask, Response, redirect, request, send_file, send_from_directory) +import visualdl import visualdl.server from visualdl.server import graph, lib -from visualdl.server import log as logger +from visualdl.server.log import logger from visualdl.server.mock import data as mock_data from visualdl.server.mock import data as mock_tags from visualdl.python.storage import (LogWriter, LogReader) - - app = Flask(__name__, static_url_path="") # set static expires in a short time to reduce browser's memory usage. app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 30 +SERVER_DIR = os.path.join(visualdl.ROOT, 'server') def option_parser(): """ @@ -51,8 +51,8 @@ def option_parser(): options, args = option_parser() server_path = os.path.abspath(os.path.dirname(sys.argv[0])) -static_file_path = "./frontend/dist/" -mock_data_path = "./mock_data/" +static_file_path = os.path.join(SERVER_DIR, "./dist") +mock_data_path = os.path.join(SERVER_DIR, "./mock_data/") log_reader = LogReader(options.logdir)