summaryrefslogtreecommitdiff
path: root/caffe2/image
diff options
context:
space:
mode:
authorJunjie Bai <jbai@fb.com>2017-09-13 14:25:33 -0700
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2017-09-13 14:35:27 -0700
commit90ca470d70733aef5d84f996a6a519f3d9254088 (patch)
treeadf1a34ebee068b7bbc597d83a1c0ea461cf83f9 /caffe2/image
parent3cfc6f26e7edbaf8143bdfc6b2043226c9eb41b9 (diff)
downloadpytorch-90ca470d70733aef5d84f996a6a519f3d9254088.tar.gz
pytorch-90ca470d70733aef5d84f996a6a519f3d9254088.tar.bz2
pytorch-90ca470d70733aef5d84f996a6a519f3d9254088.zip
Standardize operator argument "is_test"
Summary: Also add the ability to mark an argument as required. Added a string constant `OpSchema::Arg_IsTest` for `is_test` arg. If users define the `is_test` argument with `ArgIsTest(...)`, then it automatically becomes required argument, in the meanwhile user can still use `Arg("is_test", ...)` to define an optional `is_test` argument. Reviewed By: akyrola Differential Revision: D5812391 fbshipit-source-id: eaaba50d027813a8012389edc6c459de23c3c728
Diffstat (limited to 'caffe2/image')
-rw-r--r--caffe2/image/image_input_op.h27
1 files changed, 17 insertions, 10 deletions
diff --git a/caffe2/image/image_input_op.h b/caffe2/image/image_input_op.h
index 072c629f21..a2ea984d25 100644
--- a/caffe2/image/image_input_op.h
+++ b/caffe2/image/image_input_op.h
@@ -143,30 +143,37 @@ ImageInputOp<Context>::ImageInputOp(
batch_size_(
OperatorBase::template GetSingleArgument<int>("batch_size", 0)),
label_type_(static_cast<LABEL_TYPE>(
- OperatorBase::template GetSingleArgument<int>("label_type", 0))),
+ OperatorBase::template GetSingleArgument<int>("label_type", 0))),
num_labels_(
OperatorBase::template GetSingleArgument<int>("num_labels", 0)),
color_(OperatorBase::template GetSingleArgument<int>("color", 1)),
color_jitter_(
- OperatorBase::template GetSingleArgument<int>("color_jitter", 0)),
+ OperatorBase::template GetSingleArgument<int>("color_jitter", 0)),
img_saturation_(OperatorBase::template GetSingleArgument<float>(
- "img_saturation", 0.4)),
+ "img_saturation",
+ 0.4)),
img_brightness_(OperatorBase::template GetSingleArgument<float>(
- "img_brightness", 0.4)),
- img_contrast_(OperatorBase::template GetSingleArgument<float>(
- "img_contrast", 0.4)),
+ "img_brightness",
+ 0.4)),
+ img_contrast_(
+ OperatorBase::template GetSingleArgument<float>("img_contrast", 0.4)),
color_lighting_(
- OperatorBase::template GetSingleArgument<int>("color_lighting", 0)),
+ OperatorBase::template GetSingleArgument<int>("color_lighting", 0)),
color_lighting_std_(OperatorBase::template GetSingleArgument<float>(
- "color_lighting_std", 0.1)),
+ "color_lighting_std",
+ 0.1)),
scale_jitter_type_(static_cast<SCALE_JITTER_TYPE>(
- OperatorBase::template GetSingleArgument<int>("scale_jitter_type", 0))),
+ OperatorBase::template GetSingleArgument<int>(
+ "scale_jitter_type",
+ 0))),
scale_(OperatorBase::template GetSingleArgument<int>("scale", -1)),
minsize_(OperatorBase::template GetSingleArgument<int>("minsize", -1)),
warp_(OperatorBase::template GetSingleArgument<int>("warp", 0)),
crop_(OperatorBase::template GetSingleArgument<int>("crop", -1)),
mirror_(OperatorBase::template GetSingleArgument<int>("mirror", 0)),
- is_test_(OperatorBase::template GetSingleArgument<int>("is_test", 0)),
+ is_test_(OperatorBase::template GetSingleArgument<int>(
+ OpSchema::Arg_IsTest,
+ 0)),
use_caffe_datum_(
OperatorBase::template GetSingleArgument<int>("use_caffe_datum", 0)),
gpu_transform_(OperatorBase::template GetSingleArgument<int>(