Loads the appropriate atlas for the given size of data; size should be the number of stored
    vertices and sub-corticel voxels stored in the cifti file.
973838
def _load_fsLR_atlasroi_for_size(size, sid=100610):
    '''
    
    '''
    from .core import subject
    # it doesn't matter what subject we request, so just use any one
    fls = _load_fsLR_atlasroi_for_size.sizes
    if size not in fls: raise ValueError('unknown fs_LR atlas size: %s' % size)
    (n,fls) = _load_fsLR_atlasroi_for_size.sizes[size]
    fl = os.path.join(subject(sid).path, 'MNINonLinear', *fls)
    dat = {'id':sid, 'cifti':True, 'hemi':('lh_LR%dk_MSMAll' % n ,'rh_LR%dk_MSMAll' % n)}
    return _load_fsLR_atlasroi(fl, dat)
630871
private int[] loadNodes(int size, int relType, Direction direction) {
        final CursorFactory cursors = ktx.cursors();
        try (NodeCursor node = cursors.allocateNodeCursor()) {
            // todo reuse array
            int[] offsets = new int[size];
            Arrays.fill(offsets,-1);
            int offset = 0;
            int maxIdx = 0;

            ktx.dataRead().allNodesScan(node);

            while (node.next()) {
                int degree = DegreeUtil.degree(node, cursors, relType, direction);
                int idx = mapId(node.nodeReference());
//                offsets[idx] = degree;
                offsets[idx] = offset;
                offset += degree;
                if (idx > maxIdx) maxIdx = idx;
            }

            return maxIdx < offsets.length -1 ? Arrays.copyOf(offsets,maxIdx+1) : offsets;
        }
    }
441523
def _init_from_csc(self, csc):
        
        if len(csc.indices) != len(csc.data):
            raise ValueError('length mismatch: {} vs {}'.format(len(csc.indices), len(csc.data)))
        handle = ctypes.c_void_p()
        _check_call(_LIB.XGDMatrixCreateFromCSCEx(c_array(ctypes.c_size_t, csc.indptr),
                                                  c_array(ctypes.c_uint, csc.indices),
                                                  c_array(ctypes.c_float, csc.data),
                                                  ctypes.c_size_t(len(csc.indptr)),
                                                  ctypes.c_size_t(len(csc.data)),
                                                  ctypes.c_size_t(csc.shape[0]),
                                                  ctypes.byref(handle)))
        self.handle = handle
1164641
public static int cudnnGetRNNWorkspaceSize(
        cudnnHandle handle, 
        cudnnRNNDescriptor rnnDesc, 
        int seqLength, 
        cudnnTensorDescriptor[] xDesc, 
        long[] sizeInBytes)
    {
        return checkResult(cudnnGetRNNWorkspaceSizeNative(handle, rnnDesc, seqLength, xDesc, sizeInBytes));
    }
876524
def load_data(self, filename, *args, **kwargs):
        
        # load parameterized data
        data = super(ParameterizedXLS, self).load_data(filename)
        # add parameter to data
        parameter_name = self.parameterization['parameter']['name']
        parameter_values = self.parameterization['parameter']['values']
        parameter_units = str(self.parameterization['parameter']['units'])
        data[parameter_name] = parameter_values * UREG(parameter_units)
        # number of sheets
        num_sheets = len(self.parameterization['parameter']['sheets'])
        # parse and concatenate parameterized data
        for key in self.parameterization['data']:
            units = str(self.parameterization['data'][key].get('units')) or ''
            datalist = []
            for n in xrange(num_sheets):
                k = key + '_' + str(n)
                datalist.append(data[k].reshape((1, -1)))
                data.pop(k)  # remove unused data keys
            data[key] = np.concatenate(datalist, axis=0) * UREG(units)
        return data
877625
def size(self):
    
    import tensorflow as tf

    if self._size is None:
      self._size = 0
      options = tf.python_io.TFRecordOptions(tf.python_io.TFRecordCompressionType.GZIP)
      for tfexample_file in self.files:
        self._size += sum(1 for x
                          in tf.python_io.tf_record_iterator(tfexample_file, options=options))

    return self._size
600922
def sizes(x):
  """"""
  def size(x):
    try:
      return x.size
    except Exception:  # pylint: disable=broad-except
      return 0
  return nested_map(x, size)
509545
def sizeHint(self, option, index):
        """"""
        # calculate size by data component
        component = index.internalPointer()
        width = self.component.duration() * self.pixelsPerms*1000
        return QtCore.QSize(width, 50)
974750
def _requiredSize(shape, dtype):
	
	return math.floor(np.prod(np.asarray(shape, dtype=np.uint64)) * np.dtype(dtype).itemsize)
1124255
def load(self, size):
        """"""
        if self.exists() and self.isfile():
            return eval(open(self).read(size))
312440
def _atlas_from_images(images):
	
	import pyglet
	widest = max(img.width for img in images)
	height = sum(img.height for img in images)

	atlas = pyglet.image.atlas.TextureAtlas(
		width=_nearest_pow2(widest), height=_nearest_pow2(height))
	textures = [atlas.add(image) for image in images]
	return atlas, textures
531342
def _read_data_legacy(prefix, batch_size):
    
    prefix = prefix.replace("\\", "/")
    folder = "/".join(prefix.split("/")[:-1])
    phase = prefix.split("/")[-1]
    config = json.load(open(prefix + '_config.json'))
    num_threads = config["num_threads"]

    filenames = [folder + "/" + f for f in listdir(folder) if isfile(join(folder, f)) and phase in f and not "config.json" in f]

    # Create a tf object for the filename list and the readers.
    filename_queue = tf.train.string_input_producer(filenames)
    readers = [_read_tf_record(filename_queue, config) for _ in range(num_threads)]

    batch_dict = tf.train.shuffle_batch_join(
        readers,
        batch_size=batch_size,
        capacity=10 * batch_size,
        min_after_dequeue=5 * batch_size
    )

    # Add batch dimension to feature and label shape

    feature_batch = {}
    label_batch = {}
    for k in batch_dict.keys():
        shape = tuple([batch_size] + list(config[k]["shape"]))
        tensor = tf.reshape(batch_dict[k], shape, name="input/"+phase+"/" + k + "_reshape")
        if "feature_" in k:
            feature_batch["_".join(k.split("_")[1:])] = tensor
        if "label_" in k:
            label_batch["_".join(k.split("_")[1:])] = tensor

    return feature_batch, label_batch
511532
def _init_fld2col_widths(self):
        """"""
        # GO info namedtuple fields: NS dcnt level depth GO D1 name
        # GO header namedtuple fields: format_txt hdr_idx
        fld2col_widths = GoSubDagWr.fld2col_widths.copy()
        for fld, wid in self.oprtfmt.default_fld2col_widths.items():
            fld2col_widths[fld] = wid
        for fld in get_hdridx_flds():
            fld2col_widths[fld] = 2
        return fld2col_widths
932720
def _compute_total_chunks(self, chunk_size):
        # type: (Descriptor, int) -> int
        
        try:
            chunks = int(math.ceil(self._ase.size / chunk_size))
        except ZeroDivisionError:
            chunks = 1
        # for stdin, override and use 1 chunk to start, this will change
        # dynamically as data as read
        if self.local_path.use_stdin:
            chunks = 1
        if (self._ase.mode != blobxfer.models.azure.StorageModes.Page and
                chunks > 50000):
            max_vector = False
            if self._ase.mode == blobxfer.models.azure.StorageModes.Block:
                if self._chunk_size == _MAX_BLOCK_BLOB_CHUNKSIZE_BYTES:
                    max_vector = True
            elif self._chunk_size == _MAX_NONBLOCK_BLOB_CHUNKSIZE_BYTES:
                max_vector = True
            if max_vector:
                raise RuntimeError(
                    ('number of chunks {} exceeds maximum permissible '
                     'limit and chunk size is set at the maximum value '
                     'for {}. Please try using stripe mode '
                     'vectorization to overcome this limitation').format(
                        chunks, self.local_path.absolute_path))
            else:
                raise RuntimeError(
                    ('number of chunks {} exceeds maximum permissible '
                     'limit for {}, please adjust chunk size higher or '
                     'set to -1 for automatic chunk size selection').format(
                         chunks, self.local_path.absolute_path))
        return chunks
1029597
def read(self, size=None):
        
        if size is None:
            size = self.size - self.position
        else:
            size = min(size, self.size - self.position)

        buf = b""
        while size > 0:
            while True:
                data, start, stop, offset = self.map[self.map_index]
                if start <= self.position < stop:
                    break
                else:
                    self.map_index += 1
                    if self.map_index == len(self.map):
                        self.map_index = 0
            length = min(size, stop - self.position)
            if data:
                self.fileobj.seek(offset + (self.position - start))
                buf += self.fileobj.read(length)
            else:
                buf += NUL * length
            size -= length
            self.position += length
        return buf
43967
def interm_size(self) -> Sequence[Shape]:
        ''''''
        return self._sizes(self._compiler.rddl.interm_size)
913656
def GetSizeHint(self, context=None, **unused_kwargs):
    
    context_state = getattr(context, 'state', {})

    subcontext = context_state.get('context', None)
    if not subcontext:
      mapped_values = context_state.get('mapped_values', None)
      subcontext = DataTypeMapContext(values={
          type(mapped_values).__name__: mapped_values})

    size_hint = 0
    for data_type_map in self._data_type_maps:
      data_type_size = data_type_map.GetSizeHint(context=subcontext)
      if data_type_size is None:
        break

      size_hint += data_type_size

    return size_hint