[all] remove friends
authorParichay Kapoor <pk.kapoor@samsung.com>
Fri, 12 Mar 2021 13:09:11 +0000 (22:09 +0900)
committerJijoong Moon <jijoong.moon@samsung.com>
Tue, 16 Mar 2021 07:06:21 +0000 (16:06 +0900)
Remove friendship between classes as it makes extending the interface
difficult. Some friendships exist which will be removed in upcoming
PRs.

See Also #986

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
nntrainer/layers/layer_internal.h
nntrainer/optimizers/optimizer_internal.h
nntrainer/tensor/weight.h

index 7de0c4d..3fb41aa 100644 (file)
@@ -56,7 +56,6 @@ class Layer : public ml::train::Layer {
 
   /** model classes can call private methods which arent exposed to public */
   friend class NeuralNetwork;
-  friend class ModelLoader;
   friend class NetworkGraph;
 
 public:
index aa0a482..25d45ce 100644 (file)
@@ -36,10 +36,6 @@ namespace nntrainer {
  */
 class Optimizer : public ml::train::Optimizer {
 
-  /** Allow layer to initialize optimizer with itself */
-  friend class Layer;
-  friend class NeuralNetwork;
-
 public:
   /**
    * @brief     Default Constructor of Optimizer Class
index bd7a63d..a5cd09b 100644 (file)
@@ -49,17 +49,6 @@ enum class WeightInitializer {
  */
 class Weight : public Var_Grad {
 
-  /** Declare layers as friend to get variable/gradient reference */
-  friend class Layer;
-  friend class Conv2DLayer;
-  friend class FullyConnectedLayer;
-  friend class BatchNormalizationLayer;
-
-  /** Declare opitmizer as friend to get variable/gradient reference */
-  friend class Optimizer;
-  friend class SGD;
-  friend class Adam;
-
 public:
   /**
    * @brief Weight default constructor