1 #include "caffe2/opt/annotations.h" 7 void Caffe2Annotation::setOperatorDef(
const caffe2::OperatorDef& opDef) {
12 bool Caffe2Annotation::hasOperatorDef()
const {
16 const caffe2::OperatorDef& Caffe2Annotation::getOperatorDef()
const {
19 "OperatorDef was never set. Use Caffe2Annotation::setOperatorDef.");
22 caffe2::OperatorDef* Caffe2Annotation::getMutableOperatorDef() {
25 "OperatorDef was never set. Use Caffe2Annotation::setOperatorDef.");
30 void Caffe2Annotation::setDeviceOption(
const caffe2::DeviceOption& devOpt) {
31 *OpDef.mutable_device_option() = devOpt;
34 bool Caffe2Annotation::hasDeviceOption()
const {
35 return OpDef.has_device_option();
38 const caffe2::DeviceOption& Caffe2Annotation::getDeviceOption()
const {
41 "DeviceOption was never set. Use Caffe2Annotation::setDeviceOption.");
42 return OpDef.device_option();
44 caffe2::DeviceOption* Caffe2Annotation::getMutableDeviceOption() {
47 "DeviceOption was never set. Use Caffe2Annotation::setDeviceOption.");
48 return OpDef.mutable_device_option();
51 void Caffe2Annotation::setDevice(std::string device) {
54 const std::string Caffe2Annotation::getDevice()
const {
58 void Caffe2Annotation::setDeviceType(
int device) {
61 int Caffe2Annotation::getDeviceType()
const {
65 void Caffe2Annotation::setParallelization(
66 Caffe2Annotation::ParallelizationScheme s,
68 parallelization_scheme_ = s;
69 parallelization_ = num;
72 Caffe2Annotation::ParallelizationScheme
73 Caffe2Annotation::getParallelizationScheme()
const {
74 return parallelization_scheme_;
77 int Caffe2Annotation::getParallelization()
const {
78 return parallelization_;
85 CAFFE_ENFORCE(key_node_,
"No key node has been annotated");
92 CAFFE_ENFORCE(length_node_,
"No length node has been annotated");
96 void Caffe2Annotation::setComponentLevels(std::vector<std::string> components) {
97 component_levels_ = components;
99 std::vector<std::string> Caffe2Annotation::getComponentLevels()
const {
100 return component_levels_;
103 bool Caffe2Annotation::classof(
const Annotation*
A) {
104 return A->getKind() == AnnotationKind::Caffe2;
Annotations allow for generic manipulation of neural network operations.
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...
does bound shape inference given a C2 net.