import tensorflow as tf

			self.value,  self.next_loc_mean, self.loc_std, self.next_loc, self.state_out, self.state_in, self.state_init = self._build_net(self.inputs, self.prev_loc, RNN_SIZE, TRAINING, a_size)  # self.goal_pos


		if TRAINING:
			self.target_v               = tf.placeholder(tf.float32, [None], 'Vtarget')
			self.advantages             = tf.placeholder(shape=[None], dtype=tf.float32)

			self.sampled_next_locs      = tf.placeholder(tf.float32, [None,2])									# sampled action is stored here
			self.policy   = gaussian_pdf(self.next_loc_mean, self.loc_std, self.sampled_next_locs)		 # Distribution == Policy


			# Loss Functions
			self.value_loss     = 0.5*tf.reduce_sum(tf.square(self.target_v - tf.reshape(self.value, shape=[-1])))

			# H(x) = Sum[p(x)*log(p(x))]
			self.entropy        = - 0.01 * tf.reduce_sum(self.policy * tf.log(tf.clip_by_value(self.policy,1e-10,1.0)))

			self.policy_loss  = - 0.2 * tf.reduce_sum( tf.log(tf.clip_by_value(self.policy[:,0],1e-15,1.0)) * self.advantages + tf.log(tf.clip_by_value(self.policy[:,1],1e-15,1.0)) * self.advantages)

			#For Normal RL Part
			self.loss           = self.value_loss + self.policy_loss - self.entropy		# removed self.blocking_loss, valid_loss, discrete_policy _loss         #+ 0.5*self.mypos_loss + 0.5*self.goalpos_loss

			#For Imitation Learning Part
			# self.bc_loss          = 0.5 * tf.reduce_mean(tf.contrib.keras.backend.categorical_crossentropy(self.optimal_actions_onehot,self.policy))
                        # self.next_loc_loss_il = 0.2 * tf.reduce_sum(tf.sqrt(tf.square(self.next_loc_mean[:-1,:] - self.il_nextloc)))

			# self.imitation_loss   = self.bc_loss    #+ self.next_loc_loss_il

			# Get gradients from local network using local losses and
			# normalize the gradients using clipping
