} else {
return ini_model_run(arg);
}
- } catch (std::invalid_argument &e) {
+ } catch (std::exception &e) {
std::cerr << "failed to run the model, reason: " << e.what() << std::endl;
return 1;
- } catch (std::regex_error &e) {
- std::cerr << "failed to run the model, reaseon: " << e.what() << std::endl;
- return 1;
}
/// should not reach here
* @brief Construct a new NearestNeighbors Layer object that does elementwise
* subtraction from mean feature vector
*/
- CentroidKNN() : Layer(), num_class(0) {}
+ CentroidKNN() : Layer(), num_class(0), weight_idx({0}) {}
/**
* @brief Move constructor.
momentum(momentum),
axis(axis),
initializers{moving_variance_initializer, moving_variance_initializer,
- gamma_initializer, beta_initializer} {}
+ gamma_initializer, beta_initializer},
+ wt_idx({0}) {}
/**
* @brief Destructor of BatchNormalizationLayer
filter_size(filter_size_),
kernel_size(kernel_size_),
stride(stride_),
- padding(padding_) {}
+ padding(padding_),
+ wt_idx({0}) {}
/**
* @brief Destructor of Conv 2D Layer
/**
* @brief Constructor of Fully Connected Layer
*/
- FullyConnectedLayer() : LayerImpl(), fc_props(props::Unit()) {}
+ FullyConnectedLayer() :
+ LayerImpl(),
+ fc_props(props::Unit()),
+ weight_idx({0}) {}
/**
* @brief Destructor of Fully Connected Layer
bool sequence = false, float dropout = 0.0) :
LayerImpl(),
props(props::Unit()),
+ wt_idx({0}),
hidden_state_activation_type(hidden_state_activation_type_),
acti_func(hidden_state_activation_type, true),
recurrent_activation_type(recurrent_activation_type_),
recurrent_acti_func(recurrent_activation_type, true),
return_sequences(sequence),
- dropout_rate(dropout){};
+ dropout_rate(dropout) {}
/**
* @brief Destructor of GRULayer
auto &ac = nntrainer::AppContext::Global();
std::unique_ptr<nntrainer::Layer> dlayer =
ac.createObject<nntrainer::Layer>(TimeDistLayer::type);
- dynamic_cast<TimeDistLayer *>(dlayer.get())->setDistLayer(std::move(layer));
+ if (dlayer.get() == nullptr)
+ throw std::invalid_argument("Error creating time distribution layer");
+ auto *time_dist_layer = dynamic_cast<TimeDistLayer *>(dlayer.get());
+ if (time_dist_layer == nullptr)
+ throw std::invalid_argument("Error casting to time distribution layer");
+ time_dist_layer->setDistLayer(std::move(layer));
layer = std::move(dlayer);
}
bool sequence = false, float dropout = 0.0) :
LayerImpl(),
props(props::Unit()),
+ wt_idx({0}),
hidden_state_activation_type(hidden_state_activation_type_),
acti_func(hidden_state_activation_type, true),
recurrent_activation_type(recurrent_activation_type_),
recurrent_acti_func(recurrent_activation_type, true),
return_sequences(sequence),
- dropout_rate(dropout){};
+ dropout_rate(dropout) {}
/**
* @brief Destructor of LSTMLayer
stride(stride_),
padding(padding_),
pool2d_props(),
+ pool_helper_idx(0),
pooling_type(pooling_type_) {}
/**
bool ret_sequence = false, float dropout = 0.0) :
LayerImpl(),
props(props::Unit()),
+ wt_idx({0}),
hidden_state_activation_type(hidden_state_activation_type_),
acti_func(hidden_state_activation_type, true),
return_sequences(ret_sequence),
* @brief Var_Grad default constructor
* @note Default variable is not need_gradient as gradient is 0 dim tensor
*/
- Var_Grad() = default;
+ Var_Grad() : Var_Grad(TensorDim()) {}
/**
* @brief Var_Grad default destructor