Sometimes I need to use different net in one model. For example, somtimes I need the value from a network call ‘critic’, sometimes I need the value from a network called ‘actor’, and sometimes I need both. My question is, can I define some function to get the critic value without using the forward function? Will this method influcence the backward propogation?
(an example)
class Model(nn.Module):
def init(self,obs_dim, action_num, device):
super(Model, self).init()
self.actor = nn.Sequential(
nn.Linear(obs_dim, action_num)
)
self.critic = nn.Sequential(
nn.Linear(obs_dim, 1)
)
def get_value(self, inputs):
    return self.critic(inputs)

def get_action(self, inputs):
    return self.actor(inputs)

def get_both(self, inputs):
      return self.actor(inputs), self.critic(inputs)