Caffe2 - C++ API
A deep learning, cross platform ML framework
shape_op.cc
1 #include "caffe2/operators/shape_op.h"
2 
3 namespace caffe2 {
4 
5 REGISTER_CPU_OPERATOR(Shape, ShapeOp<CPUContext>);
6 
7 OPERATOR_SCHEMA(Shape)
8  .NumInputs(1)
9  .NumOutputs(1)
10  .TensorInferenceFunction([](const OperatorDef& /*def*/,
11  const vector<TensorShape>& in) {
12  vector<TensorShape> out(1);
13  out[0].add_dims(in[0].dims().size());
14  out[0].set_data_type(TensorProto::INT32);
15  return out;
16  })
17  .SetDoc("Produce a 1D int64 tensor with the shape of the input tensor.");
18 
19 SHOULD_NOT_DO_GRADIENT(Shape);
20 
21 } // namespace caffe2
A global dictionary that holds information about what Caffe2 modules have been loaded in the current ...