def clone_sp_output_tensor_for(self, layer_id: int) -> torch.Tensor:
        flock = self._get_flock(layer_id)
        flock_size = self.get_flock_size_of(layer_id)

        if type(flock) is ExpertFlockNode or type(
                flock) is ConvExpertFlockNode:
            # turns out that the conv expert can have shape [2,2,num_cc]
            return FlockNodeAccessor.get_sp_output_tensor(flock).clone().view(
                flock_size, -1)
        if type(flock) is SpatialPoolerFlockNode or type(
                flock) is ConvSpatialPoolerFlockNode:
            return SpatialPoolerFlockNodeAccessor.get_output_tensor(
                flock).clone().view(flock_size, -1)

        logger.error(f'unsupported flock class type')
Ejemplo n.º 2
0
 def sp_output_tensor(self) -> torch.Tensor:
     return SpatialPoolerFlockNodeAccessor.get_output_tensor(
         self.flock_node)