MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / CollectOpDependencies

Function CollectOpDependencies

tensorflow/java/src/gen/cc/op_generator.cc:77–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77void 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
114void WriteSetAttrDirective(const AttributeSpec& attr, bool optional,
115 SourceWriter* writer) {

Callers 1

GenerateOpFunction · 0.85

Calls 9

has_default_valueMethod · 0.80
typeMethod · 0.65
push_backMethod · 0.45
inputsMethod · 0.45
varMethod · 0.45
iterableMethod · 0.45
outputsMethod · 0.45
kindMethod · 0.45
default_valueMethod · 0.45

Tested by

no test coverage detected