提交 6723bd83 编写于 作者: J Jeff Wang 提交者: daminglu

Update documentation (#357)

上级 6408cbfe
......@@ -230,9 +230,18 @@ PYBIND11_MODULE(core, m) {
.def("record", &cp::ImageReader::record)
.def("timestamp", &cp::ImageReader::timestamp);
py::class_<cp::Text>(m, "TextWriter")
py::class_<cp::Text>(m, "TextWriter", R"pbdoc(
PyBind class. Must instantiate through the LogWriter.
)pbdoc")
.def("set_caption", &cp::Text::SetCaption)
.def("add_record", &cp::Text::AddRecord);
.def("add_record", &cp::Text::AddRecord, R"pbdoc(
Add a record with the step and text value.
:param step: Current step value
:type index: integer
:param text: Text record
:type text: basestring
)pbdoc");
py::class_<cp::TextReader>(m, "TextReader")
.def("records", &cp::TextReader::records)
......@@ -311,11 +320,13 @@ PYBIND11_MODULE(core, m) {
.def("record", &cp::AudioReader::record)
.def("timestamp", &cp::AudioReader::timestamp);
#define ADD_HISTOGRAM_WRITER(T) \
py::class_<cp::Histogram<T>>(m, "HistogramWriter__" #T, \
R"pbdoc(PyBind class. Must instantiate through the LogWriter.)pbdoc") \
.def("add_record", \
&cp::Histogram<T>::AddRecord, \
#define ADD_HISTOGRAM_WRITER(T) \
py::class_<cp::Histogram<T>>( \
m, \
"HistogramWriter__" #T, \
R"pbdoc(PyBind class. Must instantiate through the LogWriter.)pbdoc") \
.def("add_record", \
&cp::Histogram<T>::AddRecord, \
R"pbdoc(add a record with the step and histogram_value)pbdoc");
ADD_FULL_TYPE_IMPL(ADD_HISTOGRAM_WRITER)
#undef ADD_HISTOGRAM_WRITER
......
......@@ -116,6 +116,12 @@ class LogReader(object):
return type2scalar[type](tag)
def text(self, tag):
"""
Get a text reader with tag
:param tag: The reader will read the text data marked with tag
:type tag: basestring
"""
check_tag_name_valid(tag)
return self.reader.get_text(tag)
......@@ -257,6 +263,15 @@ class LogWriter(object):
return self.writer.new_audio(tag, num_samples, step_cycle)
def text(self, tag):
"""
Create a text writer that used to write
text related data.
:param tag: The text writer will label the data with tag
:type tag: basestring
:return: A text writer to record distribution
:rtype: TextWriter
"""
check_tag_name_valid(tag)
return self.writer.new_text(tag)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册