| 85 | }; |
| 86 | |
| 87 | class AttributeSpec { |
| 88 | public: |
| 89 | // A specification for an operation attribute |
| 90 | // |
| 91 | // op_def_name: attribute name, as known by TensorFlow core |
| 92 | // var: a variable to represent this attribute in Java |
| 93 | // type: the type of this attribute |
| 94 | // jni_type: the type of this attribute in JNI layer (see OperationBuilder) |
| 95 | // description: a description of this attribute, in javadoc |
| 96 | // iterable: true if this attribute is a list |
| 97 | // default_value: default value for this attribute or nullptr if none. Any |
| 98 | // value referenced by this pointer must outlive the lifetime |
| 99 | // of the AttributeSpec. This is guaranteed if the value is |
| 100 | // issued by an OpDef of the global OpRegistry. |
| 101 | AttributeSpec(const string& op_def_name, const Variable& var, |
| 102 | const Type& type, const Type& jni_type, |
| 103 | const string& description, bool iterable, |
| 104 | const AttrValue* default_value) |
| 105 | : op_def_name_(op_def_name), |
| 106 | var_(var), |
| 107 | type_(type), |
| 108 | description_(description), |
| 109 | iterable_(iterable), |
| 110 | jni_type_(jni_type), |
| 111 | default_value_(default_value) {} |
| 112 | |
| 113 | const string& op_def_name() const { return op_def_name_; } |
| 114 | const Variable& var() const { return var_; } |
| 115 | const Type& type() const { return type_; } |
| 116 | const string& description() const { return description_; } |
| 117 | bool iterable() const { return iterable_; } |
| 118 | const Type& jni_type() const { return jni_type_; } |
| 119 | bool has_default_value() const { return default_value_ != nullptr; } |
| 120 | const AttrValue* default_value() const { return default_value_; } |
| 121 | |
| 122 | private: |
| 123 | const string op_def_name_; |
| 124 | const Variable var_; |
| 125 | const Type type_; |
| 126 | const string description_; |
| 127 | const bool iterable_; |
| 128 | const Type jni_type_; |
| 129 | const AttrValue* default_value_; |
| 130 | }; |
| 131 | |
| 132 | class OpSpec { |
| 133 | public: |
no outgoing calls