dmlc / dmlc/dmlc-core

How to use dmlc::optional<self defined struct> in dmlc::Parameter?

Open
#371 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
878
Forks
526
Avg merge
12d 19h
Merged PRs (30d)
1

Description

I use struct definition like follow,

struct BlobProto : public dmlc::Parameter{
dmlc::optional sShape;
nnvm::Tuple> tupfData;
nnvm::Tuple> tupfDiff;
DMLC_DECLARE_PARAMETER(BlobProto) {
DMLC_DECLARE_FIELD(sShape)
.set_default(dmlc::optional< TShape >());
DMLC_DECLARE_FIELD(tupfData)
.set_default(nnvm::Tuple< dmlc::optional< float > >());
DMLC_DECLARE_FIELD(tupfDiff)
.set_default(nnvm::Tuple< dmlc::optional< float > >());
}
struct LayerParameter : public dmlc::Parameter< LayerParameter > {
...
nnvm::Tuple> tupBlobs;
...
DMLC_DECLARE_PARAMETER(LayerParameter) {
DMLC_DECLARE_FIELD(tupBlobs)
.set_default(nnvm::Tuple< dmlc::optional< BlobProto > >());
}
}

if I use DMLC_DECLARE_FIELD(tupBlobs), it will be error.
if I don't use DMLC_DECLARE_FIELD(tupBlobs), i can't use dmlc::JSONWriter to print structure.
how to make it work?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.