'Computes the backend specific size needed for an iobuf with a specified
shape that is meant to be shared between layers.
Arguments:
shape (tuple): Requested iobuf shape
parallelism (string): Parallelism of layer requesting this iobuf
Returns:
int: Size of required iobuf'

def shared_iobuf_size(self, shape, parallelism):

    num_dev = (1 if (parallelism in ('Data', 'Model')) else getattr(self, 'num_dev', 1))
    return (num_dev * int(np.prod(shape)))
