def get_param_type_and_layer_index(self, param_name):
     type = None
     layer_index = -1
     block_index = -1
     tensor_index = -1
     if not LAYER_STR in param_name:
         type = self.conv_or_bn_type(param_name)
         if type != ParameterType.FC_WEIGHTS:
             tensor_index = int_from_str(param_name)[0]
     else:
         layer_index, block_index, tensor_index = int_from_str(param_name)
         type = self.conv_or_bn_type(param_name)
     return type, tensor_index, layer_index, block_index
    def get_param_type_and_layer_index(self, param_name):
        type = None

        if RCNN_BASE_STR in param_name:
            if WEIGHT_STR in param_name:
                type = ParameterType.CNN_WEIGHTS
            else:
                type = ParameterType.CNN_BIAS

        tensor_index = -1
        if (type == ParameterType.CNN_WEIGHTS or type == ParameterType.CNN_BIAS
            ) and len(int_from_str(param_name)) != 0:
            tensor_index = int_from_str(param_name)[0]

        return type, tensor_index, -1, -1
 def get_param_type_and_layer_index(self, param_name):
     type = None
     if WEIGHT_STR in param_name:
         if FEATURES_STR in param_name:
             type = ParameterType.CNN_WEIGHTS
         else:
             type = ParameterType.FC_WEIGHTS
     elif BIAS_STR in param_name:
         if FEATURES_STR in param_name:
             type = ParameterType.CNN_BIAS
         else:
             type = ParameterType.FC_BIAS
     tensor_index = -1
     if len(int_from_str(param_name)) != 0:
         tensor_index = int_from_str(param_name)[0]
         if tensor_index in self.batch_norm_index:
             if WEIGHT_STR in param_name:
                 type = ParameterType.BN_WEIGHT
             else:
                 type = ParameterType.BN_BIAS
     return type, tensor_index, -1, -1
    def conv_or_bn_type(self, param_name):
        if CONV_STR in param_name:
            return ParameterType.CNN_WEIGHTS
        elif BN_STR in param_name:
            if WEIGHT_STR in param_name:
                return ParameterType.BN_WEIGHT
            else:
                return ParameterType.BN_BIAS
        elif DOWNSAMPLE_STR in param_name:
            downsample_index = int_from_str(param_name)[2]

            if downsample_index == 0:
                if WEIGHT_STR in param_name:
                    return ParameterType.DOWNSAMPLE_WEIGHTS
                else:
                    return ParameterType.DOWNSAMPLE_BIAS
            else:
                if WEIGHT_STR in param_name:
                    return ParameterType.DOWNSAMPLE_BN_W
                else:
                    return ParameterType.DOWNSAMPLE_BN_B
        elif FC_STR in param_name:
            return ParameterType.FC_WEIGHTS