| 75 | } |
| 76 | |
| 77 | void CollectOpDependencies(const OpSpec& op, RenderMode mode, |
| 78 | std::list<Type>* out) { |
| 79 | out->push_back(Type::Class("Operation", "org.tensorflow")); |
| 80 | out->push_back(Type::Class("OperationBuilder", "org.tensorflow")); |
| 81 | out->push_back(Type::Class("Scope", "org.tensorflow.op")); |
| 82 | if (mode == OPERAND) { |
| 83 | out->push_back(Type::Class("Output", "org.tensorflow")); |
| 84 | } else if (mode == LIST_OPERAND) { |
| 85 | out->push_back(Type::Interface("Iterator", "java.util")); |
| 86 | } |
| 87 | // Don't pay attention to duplicate types in the dependency list, they will |
| 88 | // be filtered out by the SourceWriter. |
| 89 | for (const ArgumentSpec& input : op.inputs()) { |
| 90 | out->push_back(input.var().type()); |
| 91 | if (input.iterable()) { |
| 92 | out->push_back(Type::Class("Operands", "org.tensorflow.op")); |
| 93 | } |
| 94 | } |
| 95 | for (const ArgumentSpec& output : op.outputs()) { |
| 96 | out->push_back(output.var().type()); |
| 97 | if (output.iterable()) { |
| 98 | out->push_back(Type::Class("Arrays", "java.util")); |
| 99 | } |
| 100 | } |
| 101 | for (const AttributeSpec& attribute : op.attributes()) { |
| 102 | out->push_back(attribute.var().type()); |
| 103 | out->push_back(attribute.jni_type()); |
| 104 | if (attribute.has_default_value() && |
| 105 | attribute.type().kind() == Type::GENERIC) { |
| 106 | out->push_back(Type::ForDataType(attribute.default_value()->type())); |
| 107 | } |
| 108 | } |
| 109 | for (const AttributeSpec& optional_attribute : op.optional_attributes()) { |
| 110 | out->push_back(optional_attribute.var().type()); |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | void WriteSetAttrDirective(const AttributeSpec& attr, bool optional, |
| 115 | SourceWriter* writer) { |
no test coverage detected