38e284c453bcdad445b300c832ec543f5a0e691e,tensorboard/summary.py,,image,#Any#Any#,149

Before Change


    if not isinstance(tensor, np.ndarray):
        // try conversion, if failed then need handle by user.
        tensor = np.ndarray(tensor, dtype=np.float32)
    shape = tensor.shape
    height, width, channel = shape[0], shape[1], shape[2]
    if channel == 1:
        // walk around. PIL"s setting on dimension.
        tensor = np.reshape(tensor, (height, width))
    image = make_image(tensor, height, width, channel)

After Change


    if not isinstance(tensor, np.ndarray):
        assert tensor.dim()<4 and tensor.dim()>1, "input tensor should be 3 dimensional."
        if tensor.dim()==2:
            tensor = tensor.unsqueeze(0)
        tensor = tensor.cpu().permute(1,2,0).numpy()
    else:
        tensor = tensor.astype(np.float32)
    tensor = (tensor*255).astype(np.uint8)
    image = make_image(tensor)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: lanpa/tensorboardX
Commit Name: 38e284c453bcdad445b300c832ec543f5a0e691e
Time: 2017-06-23
Author: huang.dexter@gmail.com
File Name: tensorboard/summary.py
Class Name:
Method Name: image


Project Name: rusty1s/pytorch_geometric
Commit Name: 22e98420bbd9c5a082c894d2df02ae0dbd41846d
Time: 2019-03-20
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/nn/models/autoencoder.py
Class Name: GAE
Method Name: eval


Project Name: lanpa/tensorboardX
Commit Name: 38e284c453bcdad445b300c832ec543f5a0e691e
Time: 2017-06-23
Author: huang.dexter@gmail.com
File Name: tensorboard/summary.py
Class Name:
Method Name: image


Project Name: HyperGAN/HyperGAN
Commit Name: 365c861ccac7588596907b0cff8ddf69cc7a966c
Time: 2020-07-27
Author: mikkel@255bits.com
File Name: hypergan/samplers/grid_sampler.py
Class Name: GridSampler
Method Name: _sample