3#ifdef CAFFE2_USE_MKLDNN
12 const std::vector<std::int64_t>&,
22 .TensorInferenceFunction([](
const OperatorDef& def,
38Imports and processes images from a database. For each run of the operator,
39batch_size images will be processed. GPUs can optionally be used for
40part of the processing.
42The following transformations are applied to the image
43 - A bounding box is applied to the initial image (optional)
44 - The image is rescaled either up or down (with the scale argument) or
45 just up (with the minsize argument)
46 - The image is randomly cropped (crop size is passed as an argument but
47 the location of the crop is random except if is_test is passed in which case
48 the image in cropped at the center)
49 - The image is normalized. Each of its color channels can have separate
52The dimension of the output image will always be cropxcrop
56 "Number of images to output for each run of the operator"
57 ". Must be 1 or greater")
58 .Arg(
"color",
"Number of color channels (1 or 3). Defaults to 1")
59 .Arg(
"color_jitter",
"Whether or not to do color jitter. Defaults to 0")
62 "Image saturation scale used in color jittering. "
66 "Image brightness scale used in color jittering. "
70 "Image contrast scale used in color jittering. "
74 "Whether or not to do color lighting."
78 "Std of normal distribution where color lighting"
79 " scaling factor is sampled. Defaults to 0.1")
82 "Type 0: No scale jittering "
83 "Type 1: Inception-style scale jittering")
86 "Type 0: single integer label for multi-class "
87 "classification. Type 1: sparse active label indices for multi-label "
88 "classification. Type 2: dense label embedding vector for label "
89 "embedding regression")
92 "Scale the size of the smallest dimension of the image to"
93 " this. Scale and minsize are mutually exclusive."
94 " Must be larger than crop")
97 "Scale the size of the smallest dimension of the image to"
98 " this only if the size is initially smaller. Scale and minsize are"
99 " mutually exclusive. Must be larger than crop.")
102 "If 1, both dimensions of the image will be set to minsize or"
103 " scale; otherwise, the other dimension is proportionally scaled."
105 .Arg(
"crop",
"Size to crop the image to. Must be provided")
106 .Arg(
"mirror",
"Whether or not to mirror the image. Defaults to 0")
109 "Mean by which to normalize color channels."
113 "Vector of means per color channel "
114 " (1 or 3 elements). Defaults to mean argument. Channel order BGR")
117 "Standard deviation by which to normalize color channels."
121 "Vector of standard dev. per color channel "
122 " (1 or 3 elements). Defaults to std argument. Channel order is BGR")
123 .Arg(
"bounding_ymin",
"Bounding box coordinate. Defaults to -1 (none)")
124 .Arg(
"bounding_xmin",
"Bounding box coordinate. Defaults to -1 (none)")
125 .Arg(
"bounding_height",
"Bounding box coordinate. Defaults to -1 (none)")
126 .Arg(
"bounding_width",
"Bounding box coordinate. Defaults to -1 (none)")
127 .ArgIsTest(
"Set to 1 to do deterministic cropping. Defaults to 0")
128 .Arg(
"use_caffe_datum",
"1 if the input is in Caffe format. Defaults to 0")
131 "1 if GPU acceleration should be used."
132 " Defaults to 0. Can only be 1 in a CUDAContext")
135 "Number of CPU decode/transform threads."
137 .Arg(
"output_type",
"If gpu_transform, can set to FLOAT or FLOAT16.")
138 .Arg(
"db",
"Name of the database (if not passed as input)")
141 "Type of database (if not passed as input)."
142 " Defaults to leveldb")
145 "The sizes of any outputs besides the data and label "
146 "(should have a number of elements equal to the number of additional "
150 "[min, max] shortest-side desired for image resize. "
151 "Defaults to [-1, -1] or no random resize desired.")
152 .Input(0,
"reader",
"The input reader (a db::DBReader)")
153 .Output(0,
"data",
"Tensor containing the images")
154 .Output(1,
"label",
"Tensor containing the labels")
157 "additional outputs",
158 "Any outputs after the first 2 will be "
159 "Tensors read from the input TensorProtos");
163#ifdef CAFFE2_USE_MKLDNN
A helper class to index into arguments.
static T GetSingleArgument(const Def &def, const string &name, const T &default_value)
A templated class to allow one to wrap a CPU operator as an IDEEP operator.
#define CHECK_GT(val1, val2)
Copyright (c) 2016-present, Facebook, Inc.
REGISTER_CPU_OPERATOR(ATen, ATenOp< CPUContext >)
REGISTER_IDEEP_OPERATOR(Softmax, IDEEPFallbackOp< SoftmaxOp< float, CPUContext > >)
parameter efficient embedding termed TT which can be plugged in into any model and trained end to end The benefits of our compressed TT layer are twofold instead of storing huge embedding it stores a sequence of much smaller dimensional and dimensional necessary for reconstructing the required which allows compressing the model significantly at the cost of a negligible performance drop the overall number of parameters can be relatively which allows to use larger batches or train efficiently in a case of limited resources DOC vector< int >
return vector< TensorShape >
ArgumentHelper helper(def)
NO_GRADIENT(SparseLengthsSumFused4BitRowwiseFakeFP16NNPI)
TensorShape CreateTensorShape(vector< T_I > dims, ::caffe2::TensorProto_DataType dt)
SparseLengths8BitsRowwiseOp< CPUContext, 0, 1 >::LENGTHS SetDoc(R"DOC(
Variation of SparseLengthsMean operator, where DATA is
stored using 8bits. DATA was quantized with 8Bit row-wise
quantization (see doc to FloatToRowwiseQuantized8Bits operator). To
restore DATA from 8Bit, we use additional input that stores scales
and biases.
)DOC") .Input(0
Represents a a compute device on which a tensor is located.