Return the Core ML spec
422216
def get_spec(self):
        
        if _mac_ver() >= (10, 14):
            return self.vggish_model.get_spec()
        else:
            vggish_model_file = VGGish()
            coreml_model_path = vggish_model_file.get_model_path(format='coreml')
            return MLModel(coreml_model_path).get_spec()
530892
def _get_flat_core_sizes(cores):
  
  core_sizes_lists = []
  for core in cores:
    flat_output_size = nest.flatten(core.output_size)
    core_sizes_lists.append(
        [tf.TensorShape(size).as_list() for size in flat_output_size])
  return core_sizes_lists
861307
def part_specs(self, part):
        '''
        
        '''
        result = self._e.parts_match(
            queries=[{'mpn_or_sku': part}],
            exact_only=True,
            show_mpn=True,
            show_manufacturer=True,
            show_octopart_url=True,
            show_short_description=True,
            show_specs=True,
            show_category_uids=True,
            show_external_links=True,
            show_reference_designs=True,
            show_cad_models=True,
            show_datasheets=True,
            include_specs=True,
            include_category_uids=True,
            include_external_links=True,
            include_reference_designs=True,
            include_cad_models=True,
            include_datasheets=True
        )
        if result[1][0]['hits'] == 0:
            print("No result")
            return ReturnValues.NO_RESULTS

        result = result[1][0]['items'][0]
        print("Showing specs for '{}':".format(result['mpn']))
        print(" → Manufacturer:      {}".format(result['manufacturer']['name']))
        print("  → Specifications:    ")
        for k,v in result['specs'].items():
            name = v['metadata']['name'] if v['metadata']['name'] else k
            min_value = v['min_value'] if v['min_value'] else ''
            max_value = v['max_value'] if v['max_value'] else ''
            unit = ' ({})'.format(v['metadata']['unit']['name']) if v['metadata']['unit'] else ''
            value = ','.join(v['value']) if len(v['value']) > 0 else ''

            if value and not (min_value or max_value):
                print("    → {:20}: {}{}".format(name, value, unit))
            elif value and min_value and max_value:
                print("    → {:20}: {}{} (min: {}, max: {})".format(name, value, unit, min_value, max_value))
            elif not value and min_value and max_value:
                print("    → {:20}:{} min: {}, max: {}".format(name, unit, min_value, max_value))
            elif not value and min_value and not max_value:
                print("    → {:20}:{} min: {}".format(name, unit, min_value))
            elif not value and not min_value and max_value:
                print("    → {:20}:{} max: {}".format(name, unit, max_value))

        print(" → URI:               {}".format(result['octopart_url']))
        if result['external_links']['evalkit_url'] \
                or result['external_links']['freesample_url'] \
                or result['external_links']['product_url']:
            print("  → External Links")
            if result['external_links']['evalkit_url']:
                print("    → Evaluation kit: {}".format(result['external_links']['evalkit_url']))
            if result['external_links']['freesample_url']:
                print("    → Free Sample: {}".format(result['external_links']['freesample_url']))
            if result['external_links']['product_url']:
                print("    → Product URI: {}".format(result['external_links']['product_url']))
        if len(result['datasheets']) > 0:
            print("  → Datasheets")
            for datasheet in result['datasheets']:
                print("    → URL:      {}".format(datasheet['url']))
                if datasheet['metadata']:
                    print("      → Updated:  {}".format(datasheet['metadata']['last_updated']))
                    print("      → Nb Pages: {}".format(datasheet['metadata']['num_pages']))
        if len(result['reference_designs']) > 0:
            print("  → Reference designs: ")
        if len(result['cad_models']) > 0:
            print("  → CAD Models:        ")
        return ReturnValues.OK
262959
def getSpec(cls):
    """"""
    spec = {
      "description": CoordinateSensorRegion.__doc__,
      "singleNodeOnly": True,
      "inputs": {},  # input data is added to queue via "addDataToQueue" command
      "outputs": {
        "dataOut": {
          "description": "Encoded coordinate SDR.",
          "dataType": "Real32",
          "count": 0,
          "regionLevel": True,
          "isDefaultOutput": True,
        },
        "resetOut": {
          "description": "0/1 reset flag output.",
          "dataType": "UInt32",
          "count": 1,
          "regionLevel": True,
          "isDefaultOutput": False,
        },
        "sequenceIdOut": {
          "description": "Sequence ID",
          "dataType": "UInt32",
          "count": 1,
          "regionLevel": True,
          "isDefaultOutput": False,
        },
      },
      "parameters": {
        "activeBits": {
          "description": "The number of bits that are set to encode a single "
                         "coordinate value",
          "dataType": "uint",
          "accessMode": "ReadWrite",
          "count": 1,
          "defaultValue": 21
        },
        "outputWidth": {
          "description": "Size of output vector",
          "dataType": "UInt32",
          "accessMode": "ReadWrite",
          "count": 1,
          "defaultValue": 1000
        },
        "radius": {
          "description": "Radius around 'coordinate'",
          "dataType": "UInt32",
          "accessMode": "ReadWrite",
          "count": 1,
          "defaultValue": 2
        },
        "verbosity": {
          "description": "Verbosity level",
          "dataType": "UInt32",
          "accessMode": "ReadWrite",
          "count": 1
        },
      },
      "commands": {
        "addDataToQueue": {
          "description": CoordinateSensorRegion.addDataToQueue.__doc__,
        },
        "addResetToQueue": {
          "description": CoordinateSensorRegion.addResetToQueue.__doc__,
        }
      },
    }

    return spec
1138339
def _get_spec(cls, fullname, path, target=None):
        """"""
        # If this ends up being a namespace package, namespace_path is
        #  the list of paths that will become its __path__
        namespace_path = []
        for entry in path:
            if not isinstance(entry, (str, bytes)):
                continue
            finder = cls._path_importer_cache(entry)
            if finder is not None:
                if hasattr(finder, 'find_spec'):
                    spec = finder.find_spec(fullname, target)
                else:
                    spec = cls._legacy_get_spec(fullname, finder)
                if spec is None:
                    continue
                if spec.loader is not None:
                    return spec
                portions = spec.submodule_search_locations
                if portions is None:
                    raise ImportError('spec missing loader')
                # This is possibly part of a namespace package.
                #  Remember these path entries (if any) for when we
                #  create a namespace package, and continue iterating
                #  on path.
                namespace_path.extend(portions)
        else:
            spec = ModuleSpec(fullname, None)
            spec.submodule_search_locations = namespace_path
            return spec
1004392
def _requirements(self):
        
        return {'memory': getattr(self, 'memory', None),
                'cores': getattr(self, 'cores', None),
                'disk': getattr(self, 'disk', None),
                'preemptable': getattr(self, 'preemptable', None)}
136518
def schema_spec_from_tuple(tup):
  """"""
  if hasattr(tup, 'get_schema_spec'):
    # Tuples have a TupleSchema field that contains a model of the schema
    return schema.from_spec({
        'fields': TupleSchemaAccess(tup),
        'required': tup.get_required_fields()})
  return schema.AnySchema()
448044
def get_model_core(model):
    
    model_label = lower('%s.%s' % (model._meta.app_label, model._meta.object_name))
    return registered_model_cores.get(model_label)
1072266
def get_fine_tune_model(symbol, arg_params, num_classes, layer_name, dtype='float32'):
    
    all_layers = symbol.get_internals()
    net = all_layers[layer_name+'_output']
    net = mx.symbol.FullyConnected(data=net, num_hidden=num_classes, name='fc')
    if dtype == 'float16':
        net = mx.sym.Cast(data=net, dtype=np.float32)
    net = mx.symbol.SoftmaxOutput(data=net, name='softmax')
    new_args = dict({k:arg_params[k] for k in arg_params if 'fc' not in k})
    return (net, new_args)
1025921
def get_rml(self, rml_def, **kwargs):
        
        if isinstance(rml_def, str):
            rml_procs = self.es_defs.get("kds_esRmlProcessor", [])
            for item in rml_procs:
                if item['name'] == rml_def:
                    rml_def = item
                    break
        proc_kwargs = {rml_def['subj']: self.subject,
                       "dataset": self.dataset}
        proc_kwargs.update(rml_def['proc_kwargs'])
        return rml_def['processor'](**proc_kwargs)
671152
def get_nested_blocks_spec(self):
        
        return [
            block_spec if isinstance(block_spec, NestedXBlockSpec) else NestedXBlockSpec(block_spec)
            for block_spec in self.allowed_nested_blocks
        ]
434005
def getSpec(cls):
    
    spec = cls.getBaseSpec()
    p, o = _getAdditionalSpecs()
    spec["parameters"].update(p)
    spec["parameters"].update(o)

    return spec
1070392
def _fetch_attribute_specs_from_doc(cls, cls_in, attribute_name):
        

        pattern = cls._TEMPLATE_PATTERN_PARAM_TYPES.format(attribute_name)
        match = re.search(pattern, cls_in.__doc__)

        if match is not None:
            return ValueSpecs(
                cls._fetch_name(match),
                ValueTypes(
                    cls._fetch_type_main(cls_in, match),
                    cls._fetch_type_sub(cls_in, match)
                )
            )
        else:
            return None
959156
def identify_core(core):
    """"""
    for datatype, identifier in {
            int: _identify_scaler,
            numpy.int8: _identify_scaler,
            numpy.int16: _identify_scaler,
            numpy.int32: _identify_scaler,
            numpy.int64: _identify_scaler,
            float: _identify_scaler,
            numpy.float16: _identify_scaler,
            numpy.float32: _identify_scaler,
            numpy.float64: _identify_scaler,
            chaospy.poly.base.Poly: _identify_poly,
            dict: _identify_dict,
            numpy.ndarray: _identify_iterable,
            list: _identify_iterable,
            tuple: _identify_iterable,
    }.items():
        if isinstance(core, datatype):
            return identifier(core)

    raise TypeError(
        "Poly arg: 'core' is not a valid type " + repr(core))
1275347
def get_core(self):
        

        if self.glucose and self.status == False:
            return pysolvers.glucose41_core(self.glucose)
152475
def get_info(dirs, parallel, resources=None):
    
    # Allow custom specification of cores/memory in resources
    if resources and isinstance(resources, dict) and "machine" in resources:
        minfo = resources["machine"]
        assert "memory" in minfo, "Require memory specification (Gb) in machine resources: %s" % minfo
        assert "cores" in minfo, "Require core specification in machine resources: %s" % minfo
        return minfo
    if parallel["type"] in ["ipython"] and not parallel["queue"] == "localrun":
        cache_file = _get_cache_file(dirs, parallel)
        if utils.file_exists(cache_file):
            with open(cache_file) as in_handle:
                minfo = yaml.safe_load(in_handle)
            return _combine_machine_info(minfo)
        else:
            return {}
    else:
        return _combine_machine_info(machine_info())
1064135
def _all_spec(self):
        

        base = self._mod_spec

        for spec in self.basic_spec:
            base[spec] = self.basic_spec[spec]

        return base