19 #ifndef SINGA_IO_DECODER_H_ 20 #define SINGA_IO_DECODER_H_ 24 #include "singa/core/tensor.h" 25 #include "singa/proto/io.pb.h" 34 virtual void Setup(
const DecoderConf& conf) {}
37 virtual std::vector<Tensor>
Decode(std::string value) = 0;
41 class JPGDecoder :
public Decoder {
45 void Setup(
const DecoderConf& conf)
override {
46 image_dim_order_ = conf.image_dim_order();
48 std::vector<Tensor>
Decode(std::string value)
override;
50 const std::string image_dim_order()
const {
return image_dim_order_; }
54 std::string image_dim_order_ =
"CHW";
62 void Setup(
const DecoderConf& conf)
override {
63 has_label_ = conf.has_label();
65 std::vector<Tensor>
Decode(std::string value)
override;
67 const bool has_label()
const {
return has_label_; }
71 bool has_label_ =
false;
74 #endif // SINGA_IO_DECODER_H_ Decode the string of csv formated data into data tensor (dtype is kFloat32) and optionally a label te...
Definition: decoder.h:60
virtual std::vector< Tensor > Decode(std::string value)=0
Decode value to get data and labels.
The base decoder that converts a string into a set of tensors.
Definition: decoder.h:29
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: common.h:48