c18ea010c0f43c5144f1c5265874709f68c2e1f3,lazyflow/utility/blockwise_view.py,,blockwise_view,#Any#Any#Any#,3

Before Change


    view_10d = blockwise_view_5d( a_5d, blockshape_5d )
    
    // Drop the extra dimensions
    slicing_5d = (0,)*padded_dims + (slice(None),)*a.ndim
    slicing_10d = slicing_5d + slicing_5d
    
    view = view_10d[slicing_10d]
    assert view.shape == tuple(numpy.array(a.shape) / blockshape) + blockshape
    if require_aligned_blocks:
        assert view.size == a.size
    return view

After Change


    // inter_block_strides = a.itemsize * numpy.array([z*y*x*bt, y*x*bz, x*by, bx])

    // strides within each block
    intra_block_strides = [1]
    for s in a.shape[-1:0:-1]:
        intra_block_strides.append( s*intra_block_strides[-1] )
    intra_block_strides = numpy.array(intra_block_strides[::-1])
    
    // strides from one block to another
    inter_block_strides = numpy.array(intra_block_strides) * blockshape
    
    intra_block_strides *= a.itemsize
    inter_block_strides *= a.itemsize

    strides = tuple(inter_block_strides) + tuple(intra_block_strides)

    // This is where the magic happens.
    // Generate a view with our new strides.
    return numpy.lib.stride_tricks.as_strided(a, shape=view_shape, strides=strides)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 6

Instances


Project Name: ilastik/ilastik
Commit Name: c18ea010c0f43c5144f1c5265874709f68c2e1f3
Time: 2015-01-28
Author: bergs@janelia.hhmi.org
File Name: lazyflow/utility/blockwise_view.py
Class Name:
Method Name: blockwise_view


Project Name: tensorflow/tpu
Commit Name: 080700865e68f22295b296e097032baa89231d99
Time: 2018-04-13
Author: huangyp@google.com
File Name: models/official/resnet/resnet_preprocessing.py
Class Name:
Method Name: distorted_bounding_box_crop


Project Name: scikit-image/scikit-image
Commit Name: 02c704530eab9c8376b029aab4047babda5c65b8
Time: 2017-10-29
Author: contact@kne42.me
File Name: skimage/measure/_moments.py
Class Name:
Method Name: moments_contour_central


Project Name: tensorflow/tpu
Commit Name: 080700865e68f22295b296e097032baa89231d99
Time: 2018-04-13
Author: huangyp@google.com
File Name: models/experimental/resnet_bfloat16/resnet_preprocessing.py
Class Name:
Method Name: distorted_bounding_box_crop