Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ShogunBoard] Refactor ParameterObserverInterface to make it pure.
Add a ParameterObserverTensorBoard class which implements the TFLogger utilities. Run also clang-format and add the new classes to SWIG.
- Loading branch information
Showing
9 changed files
with
108 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Written (W) 2017 Giovanni De Toni | ||
*/ | ||
|
||
#include "ParameterObserverTensorBoard.h" | ||
|
||
using namespace shogun; | ||
|
||
ParameterObserverTensorBoard::ParameterObserverTensorBoard() | ||
: ParameterObserverInterface(), m_writer("shogun") | ||
{ | ||
m_writer.init(); | ||
} | ||
|
||
ParameterObserverTensorBoard::ParameterObserverTensorBoard( | ||
std::vector<std::string>& parameters) | ||
: ParameterObserverInterface(parameters), m_writer("shogun") | ||
{ | ||
m_writer.init(); | ||
} | ||
|
||
ParameterObserverTensorBoard::ParameterObserverTensorBoard( | ||
const std::string& filename, std::vector<std::string>& parameters) | ||
: ParameterObserverInterface(parameters), m_writer(filename.c_str()) | ||
{ | ||
m_writer.init(); | ||
} | ||
|
||
ParameterObserverTensorBoard::~ParameterObserverTensorBoard() | ||
: ~ParameterObserverTensorBoard() | ||
{ | ||
m_writer.flush(); | ||
m_writer.close(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Written (W) 2017 Giovanni De Toni | ||
*/ | ||
|
||
#ifndef SHOGUN_PARAMETEROBSERVERTENSORBOARD_H | ||
#define SHOGUN_PARAMETEROBSERVERTENSORBOARD_H | ||
|
||
#include <shogun/lib/ParameterObserverInterface.h> | ||
|
||
#include <tflogger/tensorflow_logger.h> | ||
|
||
namespace shogun | ||
{ | ||
class ParameterObserverTensorBoard : public ParameterObserverInterface | ||
{ | ||
|
||
public: | ||
/** | ||
* Default constructor | ||
*/ | ||
ParameterObserverTensorBoard(); | ||
|
||
/** | ||
* Constructor | ||
* @param parameters list of parameters which we want to watch over | ||
*/ | ||
ParameterObserverTensorBoard(std::vector<std::string>& parameters); | ||
|
||
/** | ||
* Constructor | ||
* @param filename name of the generated output file | ||
* @param parameters list of parameters which we want to watch over | ||
*/ | ||
ParameterObserverTensorBoard( | ||
const std::string& filename, std::vector<std::string>& parameters); | ||
/** | ||
* Virtual destructor | ||
*/ | ||
virtual ~ParameterObserverTensorBoard(); | ||
|
||
protected: | ||
/** | ||
* Writer object which will be used to write tensorflow::Event files | ||
*/ | ||
tflogger::TensorFlowLogger m_writer; | ||
}; | ||
} | ||
|
||
#endif // SHOGUN_PARAMETEROBSERVERTENSORBOARD_H |