op_desc.proto 1.8 KB
Newer Older
Q
Qiao Longfei 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */

L
liaogang 已提交
15
syntax = "proto2";
Q
Qiao Longfei 已提交
16 17
package paddle.framework;

Y
Yi Wang 已提交
18
import "attribute.proto";
Q
Qiao Longfei 已提交
19 20 21 22 23 24

// AttrDesc is used to describe Attributes of an Operator. It contain's
// name, type, and value of Attribute.
//
// e.g, for scale=3.0: name=scala, type=AttrType.FLOAT, value=3.0
message AttrDesc {
L
liaogang 已提交
25 26 27 28 29 30 31 32
  required string name = 1;
  required AttrType type = 2;
  optional int32 i = 3;
  optional float f = 4;
  optional string s = 5;
  repeated int32 ints = 6;
  repeated float floats = 7;
  repeated string strings = 8;
Q
Qiao Longfei 已提交
33 34 35 36 37 38 39 40 41 42 43 44
};

// Protocol Message to describe an Operator.
//
// In PaddlePaddle, Operator is used to do a certain computation such
// as "add", "sub", "cosine", etc.
//  (1) Operator needs to know the input and output variable names.
//  (2) Some ops may have special attributes such as "scale" in "CosineOp".
//
// 3rd-party language can build this proto message and call
// AddOp(const OpDesc& op_desc) of Paddle core to create an Operator.
message OpDesc {
L
liaogang 已提交
45 46
  // input names of this Operator.
  repeated string inputs = 1;
Q
Qiao Longfei 已提交
47

L
liaogang 已提交
48 49
  // output names of this Operator.
  repeated string outputs = 2;
Q
Qiao Longfei 已提交
50

L
liaogang 已提交
51 52
  // type of this Operator, such as "add", "sub", "fc".
  required string type = 3;
Q
Qiao Longfei 已提交
53

L
liaogang 已提交
54 55
  // Attributes of this Operator. e.g., scale=3.0 in cosine op.
  repeated AttrDesc attrs = 4;
Q
Qiao Longfei 已提交
56
};