


from dataclasses import dataclass
from typing import Optional

import numpy as np
import torch
import torch.nn as nn

from ..utils import BaseOutput, is_torch_version, randn_tensor
from .attention_processor import SpatialNorm
from .unet_ad_blocks import UNetMidBlockaD, get_down_block, get_up_block

@dataclass
class     a		(_lowerCAmelCase				):




							"""simple docstring"""


							__UpperCAmelCase   :							torch.FloatTensor

class     a		(nn.Module				):




							"""simple docstring"""


							def __init__(							self	:  Optional[int]   ,     lowerCamelCase	:  Any=3   ,     lowerCamelCase	:  List[str]=3   ,     lowerCamelCase	:  List[str]=("DownEncoderBlock2D",)   ,     lowerCamelCase	:  List[str]=(64,)   ,     lowerCamelCase	:  int=2   ,     lowerCamelCase	:  Tuple=32   ,     lowerCamelCase	:  Union[str, Any]="silu"   ,     lowerCamelCase	:  int=True   ,     )     ->   int:
														super().__init__()
														__snake_case		:      Dict										=       layers_per_block

														__snake_case		:      Optional[int]										=       torch.nn.Convad(
														    lowerCamelCase   ,     block_out_channels[0]   ,     kernel_size=3   ,     stride=1   ,     padding=1   ,     )

														__snake_case		:      str										=       None
														__snake_case		:      Any										=       nn.ModuleList([]    )

														# down
														__snake_case		:      Optional[int]										=       block_out_channels[0]
														for i, down_block_type in enumerate(lowerCamelCase    ):
																					__snake_case		:      int										=       output_channel
																					__snake_case		:      List[Any]										=       block_out_channels[i]
																					__snake_case		:      Any										=       i == len(lowerCamelCase    ) - 1

																					__snake_case		:      Any										=       get_down_block(
																					    lowerCamelCase   ,     num_layers=self.layers_per_block   ,     in_channels=lowerCamelCase   ,     out_channels=lowerCamelCase   ,     add_downsample=not is_final_block   ,     resnet_eps=1E-6   ,     downsample_padding=0   ,     resnet_act_fn=lowerCamelCase   ,     resnet_groups=lowerCamelCase   ,     attention_head_dim=lowerCamelCase   ,     temb_channels=lowerCamelCase   ,     )
																					self.down_blocks.append(lowerCamelCase    )

														# mid
														__snake_case		:      Optional[int]										=       UNetMidBlockaD(
														    in_channels=block_out_channels[-1]   ,     resnet_eps=1E-6   ,     resnet_act_fn=lowerCamelCase   ,     output_scale_factor=1   ,     resnet_time_scale_shift="default"   ,     attention_head_dim=block_out_channels[-1]   ,     resnet_groups=lowerCamelCase   ,     temb_channels=lowerCamelCase   ,     )

														# out
														__snake_case		:      Union[str, Any]										=       nn.GroupNorm(num_channels=block_out_channels[-1]   ,     num_groups=lowerCamelCase   ,     eps=1E-6    )
														__snake_case		:      str										=       nn.SiLU()

														__snake_case		:      List[Any]										=       2 * out_channels if double_z else out_channels
														__snake_case		:      int										=       nn.Convad(block_out_channels[-1]   ,     lowerCamelCase   ,     3   ,     padding=1    )

														__snake_case		:      Tuple										=       False






							def    __snake_case (							self	:  Tuple   ,     lowerCamelCase	:  str    )     ->   Optional[Any]:
														__snake_case		:      int										=       x
														__snake_case		:      Optional[Any]										=       self.conv_in(lowerCamelCase    )

														if self.training and self.gradient_checkpointing:

																					def create_custom_forward(lowerCamelCase	:  Any    ):
																												def custom_forward(*lowerCamelCase	:  List[str]    ):
																																			return module(*lowerCamelCase    )

																												return custom_forward

																					# down
																					if is_torch_version(">="   ,     "1.11.0"    ):
																												for down_block in self.down_blocks:
																																			__snake_case		:      str										=       torch.utils.checkpoint.checkpoint(
																																			    create_custom_forward(lowerCamelCase    )   ,     lowerCamelCase   ,     use_reentrant=lowerCamelCase    )
																												# middle
																												__snake_case		:      Optional[Any]										=       torch.utils.checkpoint.checkpoint(
																												    create_custom_forward(self.mid_block    )   ,     lowerCamelCase   ,     use_reentrant=lowerCamelCase    )
																					else:
																												for down_block in self.down_blocks:
																																			__snake_case		:      int										=       torch.utils.checkpoint.checkpoint(create_custom_forward(lowerCamelCase    )   ,     lowerCamelCase    )
																												# middle
																												__snake_case		:      Optional[Any]										=       torch.utils.checkpoint.checkpoint(create_custom_forward(self.mid_block    )   ,     lowerCamelCase    )

														else:
																					# down
																					for down_block in self.down_blocks:
																												__snake_case		:      Union[str, Any]										=       down_block(lowerCamelCase    )

																					# middle
																					__snake_case		:      List[Any]										=       self.mid_block(lowerCamelCase    )

														# post-process
														__snake_case		:      Any										=       self.conv_norm_out(lowerCamelCase    )
														__snake_case		:      Union[str, Any]										=       self.conv_act(lowerCamelCase    )
														__snake_case		:      int										=       self.conv_out(lowerCamelCase    )

														return sample

class     a		(nn.Module				):




							"""simple docstring"""


							def __init__(							self	:  Any   ,     lowerCamelCase	:  Tuple=3   ,     lowerCamelCase	:  Optional[Any]=3   ,     lowerCamelCase	:  Any=("UpDecoderBlock2D",)   ,     lowerCamelCase	:  int=(64,)   ,     lowerCamelCase	:  Union[str, Any]=2   ,     lowerCamelCase	:  List[Any]=32   ,     lowerCamelCase	:  Any="silu"   ,     lowerCamelCase	:  str="group"   ,     )     ->   Union[str, Any]:
														super().__init__()
														__snake_case		:      Optional[int]										=       layers_per_block

														__snake_case		:      int										=       nn.Convad(
														    lowerCamelCase   ,     block_out_channels[-1]   ,     kernel_size=3   ,     stride=1   ,     padding=1   ,     )

														__snake_case		:      List[Any]										=       None
														__snake_case		:      List[str]										=       nn.ModuleList([]    )

														__snake_case		:      Any										=       in_channels if norm_type == "spatial" else None

														# mid
														__snake_case		:      Dict										=       UNetMidBlockaD(
														    in_channels=block_out_channels[-1]   ,     resnet_eps=1E-6   ,     resnet_act_fn=lowerCamelCase   ,     output_scale_factor=1   ,     resnet_time_scale_shift="default" if norm_type == "group" else norm_type   ,     attention_head_dim=block_out_channels[-1]   ,     resnet_groups=lowerCamelCase   ,     temb_channels=lowerCamelCase   ,     )

														# up
														__snake_case		:      List[str]										=       list(reversed(lowerCamelCase    )    )
														__snake_case		:      Optional[Any]										=       reversed_block_out_channels[0]
														for i, up_block_type in enumerate(lowerCamelCase    ):
																					__snake_case		:      str										=       output_channel
																					__snake_case		:      int										=       reversed_block_out_channels[i]

																					__snake_case		:      List[str]										=       i == len(lowerCamelCase    ) - 1

																					__snake_case		:      Optional[Any]										=       get_up_block(
																					    lowerCamelCase   ,     num_layers=self.layers_per_block + 1   ,     in_channels=lowerCamelCase   ,     out_channels=lowerCamelCase   ,     prev_output_channel=lowerCamelCase   ,     add_upsample=not is_final_block   ,     resnet_eps=1E-6   ,     resnet_act_fn=lowerCamelCase   ,     resnet_groups=lowerCamelCase   ,     attention_head_dim=lowerCamelCase   ,     temb_channels=lowerCamelCase   ,     resnet_time_scale_shift=lowerCamelCase   ,     )
																					self.up_blocks.append(lowerCamelCase    )
																					__snake_case		:      Optional[Any]										=       output_channel

														# out
														if norm_type == "spatial":
																					__snake_case		:      Optional[Any]										=       SpatialNorm(block_out_channels[0]   ,     lowerCamelCase    )
														else:
																					__snake_case		:      List[str]										=       nn.GroupNorm(num_channels=block_out_channels[0]   ,     num_groups=lowerCamelCase   ,     eps=1E-6    )
														__snake_case		:      Dict										=       nn.SiLU()
														__snake_case		:      Any										=       nn.Convad(block_out_channels[0]   ,     lowerCamelCase   ,     3   ,     padding=1    )

														__snake_case		:      str										=       False






							def    __snake_case (							self	:  Tuple   ,     lowerCamelCase	:  Dict   ,     lowerCamelCase	:  Union[str, Any]=None    )     ->   Optional[Any]:
														__snake_case		:      str										=       z
														__snake_case		:      Tuple										=       self.conv_in(lowerCamelCase    )

														__snake_case		:      int										=       next(iter(self.up_blocks.parameters()    )    ).dtype
														if self.training and self.gradient_checkpointing:

																					def create_custom_forward(lowerCamelCase	:  str    ):
																												def custom_forward(*lowerCamelCase	:  Optional[Any]    ):
																																			return module(*lowerCamelCase    )

																												return custom_forward

																					if is_torch_version(">="   ,     "1.11.0"    ):
																												# middle
																												__snake_case		:      Optional[int]										=       torch.utils.checkpoint.checkpoint(
																												    create_custom_forward(self.mid_block    )   ,     lowerCamelCase   ,     lowerCamelCase   ,     use_reentrant=lowerCamelCase    )
																												__snake_case		:      str										=       sample.to(lowerCamelCase    )

																												# up
																												for up_block in self.up_blocks:
																																			__snake_case		:      str										=       torch.utils.checkpoint.checkpoint(
																																			    create_custom_forward(lowerCamelCase    )   ,     lowerCamelCase   ,     lowerCamelCase   ,     use_reentrant=lowerCamelCase    )
																					else:
																												# middle
																												__snake_case		:      List[str]										=       torch.utils.checkpoint.checkpoint(
																												    create_custom_forward(self.mid_block    )   ,     lowerCamelCase   ,     lowerCamelCase    )
																												__snake_case		:      Dict										=       sample.to(lowerCamelCase    )

																												# up
																												for up_block in self.up_blocks:
																																			__snake_case		:      Any										=       torch.utils.checkpoint.checkpoint(create_custom_forward(lowerCamelCase    )   ,     lowerCamelCase   ,     lowerCamelCase    )
														else:
																					# middle
																					__snake_case		:      List[Any]										=       self.mid_block(lowerCamelCase   ,     lowerCamelCase    )
																					__snake_case		:      Union[str, Any]										=       sample.to(lowerCamelCase    )

																					# up
																					for up_block in self.up_blocks:
																												__snake_case		:      Any										=       up_block(lowerCamelCase   ,     lowerCamelCase    )

        # post-process
														if latent_embeds is None:
																					__snake_case		:      str										=       self.conv_norm_out(lowerCamelCase    )
														else:
																					__snake_case		:      List[Any]										=       self.conv_norm_out(lowerCamelCase   ,     lowerCamelCase    )
														__snake_case		:      int										=       self.conv_act(lowerCamelCase    )
														__snake_case		:      str										=       self.conv_out(lowerCamelCase    )

														return sample

class     a		(nn.Module				):




							"""simple docstring"""


							def __init__(							self	:  Dict   ,     lowerCamelCase	:  str   ,     lowerCamelCase	:  List[str]   ,     lowerCamelCase	:  Optional[int]   ,     lowerCamelCase	:  Optional[Any]=None   ,     lowerCamelCase	:  int="random"   ,     lowerCamelCase	:  int=False   ,     lowerCamelCase	:  Optional[int]=True    )     ->   Dict:
														super().__init__()
														__snake_case		:      List[str]										=       n_e
														__snake_case		:      str										=       vq_embed_dim
														__snake_case		:      Optional[int]										=       beta
														__snake_case		:      List[str]										=       legacy

														__snake_case		:      str										=       nn.Embedding(self.n_e   ,     self.vq_embed_dim    )
														self.embedding.weight.data.uniform_(-1.0 / self.n_e   ,     1.0 / self.n_e    )

														__snake_case		:      Any										=       remap
														if self.remap is not None:
																					self.register_buffer("used"   ,     torch.tensor(np.load(self.remap    )    )    )
																					__snake_case		:      int										=       self.used.shape[0]
																					__snake_case		:      int										=       unknown_index  # "random" or "extra" or integer
																					if self.unknown_index == "extra":
																												__snake_case		:      Tuple										=       self.re_embed
																												__snake_case		:      Any										=       self.re_embed + 1
																					print(
																					    F'Remapping {self.n_e} indices to {self.re_embed} indices. '
																					    F'Using {self.unknown_index} for unknown indices.'    )
														else:
																					__snake_case		:      List[Any]										=       n_e

														__snake_case		:      Tuple										=       sane_index_shape

							def    __snake_case (							self	:  Dict   ,     lowerCamelCase	:  Optional[int]    )     ->   Optional[int]:
														__snake_case		:      List[Any]										=       inds.shape
														assert len(lowerCamelCase    ) > 1
														__snake_case		:      Union[str, Any]										=       inds.reshape(ishape[0]   ,     -1    )
														__snake_case		:      Optional[Any]										=       self.used.to(lowerCamelCase    )
														__snake_case		:      Tuple										=       (inds[:, :, None] == used[None, None, ...]).long()
														__snake_case		:      Optional[Any]										=       match.argmax(-1    )
														__snake_case		:      Dict										=       match.sum(2    ) < 1
														if self.unknown_index == "random":
																					__snake_case		:      Optional[int]										=       torch.randint(0   ,     self.re_embed   ,     size=new[unknown].shape    ).to(device=new.device    )
														else:
																					__snake_case		:      int										=       self.unknown_index
														return new.reshape(lowerCamelCase    )

							def    __snake_case (							self	:  Union[str, Any]   ,     lowerCamelCase	:  List[str]    )     ->   Any:
														__snake_case		:      int										=       inds.shape
														assert len(lowerCamelCase    ) > 1
														__snake_case		:      str										=       inds.reshape(ishape[0]   ,     -1    )
														__snake_case		:      Any										=       self.used.to(lowerCamelCase    )
														if self.re_embed > self.used.shape[0]:  # extra token
																					__snake_case		:      Optional[Any]										=       0  # simply set to zero
														__snake_case		:      List[str]										=       torch.gather(used[None, :][inds.shape[0] * [0], :]   ,     1   ,     lowerCamelCase    )
														return back.reshape(lowerCamelCase    )

							def    __snake_case (							self	:  int   ,     lowerCamelCase	:  int    )     ->   List[str]:
														# reshape z -> (batch, height, width, channel) and flatten
														__snake_case		:      Dict										=       z.permute(0   ,     2   ,     3   ,     1    ).contiguous()
														__snake_case		:      Tuple										=       z.view(-1   ,     self.vq_embed_dim    )

														# distances from z to embeddings e_j (z - e)^2 = z^2 + e^2 - 2 e * z
														__snake_case		:      List[Any]										=       torch.argmin(torch.cdist(lowerCamelCase   ,     self.embedding.weight    )   ,     dim=1    )

														__snake_case		:      Dict										=       self.embedding(lowerCamelCase    ).view(z.shape    )
														__snake_case		:      Dict										=       None
														__snake_case		:      str										=       None

														# compute loss for embedding
														if not self.legacy:
																					__snake_case		:      Tuple										=       self.beta * torch.mean((z_q.detach() - z) ** 2    ) + torch.mean((z_q - z.detach()) ** 2    )
														else:
																					__snake_case		:      List[Any]										=       torch.mean((z_q.detach() - z) ** 2    ) + self.beta * torch.mean((z_q - z.detach()) ** 2    )

														# preserve gradients
														__snake_case		:      Union[str, Any]										=       z + (z_q - z).detach()

														# reshape back to match original input shape
														__snake_case		:      List[str]										=       z_q.permute(0   ,     3   ,     1   ,     2    ).contiguous()

														if self.remap is not None:
																					__snake_case		:      Dict										=       min_encoding_indices.reshape(z.shape[0]   ,     -1    )  # add batch axis
																					__snake_case		:      Optional[int]										=       self.remap_to_used(lowerCamelCase    )
																					__snake_case		:      Any										=       min_encoding_indices.reshape(-1   ,     1    )  # flatten

														if self.sane_index_shape:
																					__snake_case		:      Optional[Any]										=       min_encoding_indices.reshape(z_q.shape[0]   ,     z_q.shape[2]   ,     z_q.shape[3]    )

														return z_q, loss, (perplexity, min_encodings, min_encoding_indices)






							def    __snake_case (							self	:  str   ,     lowerCamelCase	:  str   ,     lowerCamelCase	:  Dict    )     ->   int:
														# shape specifying (batch, height, width, channel)
														if self.remap is not None:
																					__snake_case		:      Optional[int]										=       indices.reshape(shape[0]   ,     -1    )  # add batch axis
																					__snake_case		:      Optional[int]										=       self.unmap_to_all(lowerCamelCase    )
																					__snake_case		:      int										=       indices.reshape(-1    )  # flatten again

														# get quantized latent vectors
														__snake_case		:      int										=       self.embedding(lowerCamelCase    )

														if shape is not None:
																					__snake_case		:      Any										=       z_q.view(lowerCamelCase    )
																					# reshape back to match original input shape
																					__snake_case		:      int										=       z_q.permute(0   ,     3   ,     1   ,     2    ).contiguous()

														return z_q

class     a		(_lowerCAmelCase				):




							"""simple docstring"""


							def __init__(							self	:  str   ,     lowerCamelCase	:  int   ,     lowerCamelCase	:  str=False    )     ->   Tuple:
														__snake_case		:      str										=       parameters
														__snake_case		:      int										=       torch.chunk(lowerCamelCase   ,     2   ,     dim=1    )
														__snake_case		:      Union[str, Any]										=       torch.clamp(self.logvar   ,     -30.0   ,     20.0    )
														__snake_case		:      Dict										=       deterministic
														__snake_case		:      Any										=       torch.exp(0.5 * self.logvar    )
														__snake_case		:      Tuple										=       torch.exp(self.logvar    )
														if self.deterministic:
																					__snake_case		:      Union[str, Any]										=       torch.zeros_like(
																					    self.mean   ,     device=self.parameters.device   ,     dtype=self.parameters.dtype    )

							def    __snake_case (							self	:  Dict   ,     lowerCamelCase	:  Optional[torch.Generator] = None    )     ->   torch.FloatTensor:
														# make sure sample is on the same device as the parameters and has same dtype
														__snake_case		:      str										=       randn_tensor(
														    self.mean.shape   ,     generator=lowerCamelCase   ,     device=self.parameters.device   ,     dtype=self.parameters.dtype    )
														__snake_case		:      Dict										=       self.mean + self.std * sample
														return x

							def    __snake_case (							self	:  str   ,     lowerCamelCase	:  Optional[Any]=None    )     ->   Optional[Any]:
														if self.deterministic:
																					return torch.Tensor([0.0]    )
														else:
																					if other is None:
																												return 0.5 * torch.sum(torch.pow(self.mean   ,     2    ) + self.var - 1.0 - self.logvar   ,     dim=[1, 2, 3]    )
																					else:
																												return 0.5 * torch.sum(
																												    torch.pow(self.mean - other.mean   ,     2    ) / other.var
																												    + self.var / other.var
																												    - 1.0
																												    - self.logvar
																												    + other.logvar   ,     dim=[1, 2, 3]   ,     )

							def    __snake_case (							self	:  int   ,     lowerCamelCase	:  Any   ,     lowerCamelCase	:  List[Any]=[1, 2, 3]    )     ->   str:
														if self.deterministic:
																					return torch.Tensor([0.0]    )
														__snake_case		:      int										=       np.log(2.0 * np.pi    )
														return 0.5 * torch.sum(logtwopi + self.logvar + torch.pow(sample - self.mean   ,     2    ) / self.var   ,     dim=lowerCamelCase    )






							def    __snake_case (							self	:  Tuple    )     ->   List[str]:
														return self.mean





from scipy.stats import spearmanr

import datasets


_snake_case					:		Optional[Any]      =    "\nThe Spearman rank-order correlation coefficient is a measure of the\nrelationship between two datasets. Like other correlation coefficients,\nthis one varies between -1 and +1 with 0 implying no correlation.\nPositive correlations imply that as data in dataset x increases, so\ndoes data in dataset y. Negative correlations imply that as x increases,\ny decreases. Correlations of -1 or +1 imply an exact monotonic relationship.\n\nUnlike the Pearson correlation, the Spearman correlation does not\nassume that both datasets are normally distributed.\n\nThe p-value roughly indicates the probability of an uncorrelated system\nproducing datasets that have a Spearman correlation at least as extreme\nas the one computed from these datasets. The p-values are not entirely\nreliable but are probably reasonable for datasets larger than 500 or so.\n"

_snake_case					:		Dict      =    "\nArgs:\n    predictions (`List[float]`): Predicted labels, as returned by a model.\n    references (`List[float]`): Ground truth labels.\n    return_pvalue (`bool`): If `True`, returns the p-value. If `False`, returns\n            only the spearmanr score. Defaults to `False`.\nReturns:\n    spearmanr (`float`): Spearman correlation coefficient.\n    p-value (`float`): p-value. **Note**: is only returned if `return_pvalue=True` is input.\nExamples:\n    Example 1:\n        >>> spearmanr_metric = datasets.load_metric(\"spearmanr\")\n        >>> results = spearmanr_metric.compute(references=[1, 2, 3, 4, 5], predictions=[10, 9, 2.5, 6, 4])\n        >>> print(results)\n        {'spearmanr': -0.7}\n\n    Example 2:\n        >>> spearmanr_metric = datasets.load_metric(\"spearmanr\")\n        >>> results = spearmanr_metric.compute(references=[1, 2, 3, 4, 5],\n        ...                                     predictions=[10, 9, 2.5, 6, 4],\n        ...                                     return_pvalue=True)\n        >>> print(results['spearmanr'])\n        -0.7\n        >>> print(round(results['spearmanr_pvalue'], 2))\n        0.19\n"

_snake_case					:		Optional[Any]      =    R"\\n@book{kokoska2000crc,\n  title={CRC standard probability and statistics tables and formulae},\n  author={Kokoska, Stephen and Zwillinger, Daniel},\n  year={2000},\n  publisher={Crc Press}\n}\n@article{2020SciPy-NMeth,\n  author  = {Virtanen, Pauli and Gommers, Ralf and Oliphant, Travis E. and\n            Haberland, Matt and Reddy, Tyler and Cournapeau, David and\n            Burovski, Evgeni and Peterson, Pearu and Weckesser, Warren and\n            Bright, Jonathan and {van der Walt}, St{\'e}fan J. and\n            Brett, Matthew and Wilson, Joshua and Millman, K. Jarrod and\n            Mayorov, Nikolay and Nelson, Andrew R. J. and Jones, Eric and\n            Kern, Robert and Larson, Eric and Carey, C J and\n            Polat, {\.I}lhan and Feng, Yu and Moore, Eric W. and\n            {VanderPlas}, Jake and Laxalde, Denis and Perktold, Josef and\n            Cimrman, Robert and Henriksen, Ian and Quintero, E. A. and\n            Harris, Charles R. and Archibald, Anne M. and\n            Ribeiro, Ant{\^o}nio H. and Pedregosa, Fabian and\n            {van Mulbregt}, Paul and {SciPy 1.0 Contributors}},\n  title   = {{{SciPy} 1.0: Fundamental Algorithms for Scientific\n            Computing in Python}},\n  journal = {Nature Methods},\n  year    = {2020},\n  volume  = {17},\n  pages   = {261--272},\n  adsurl  = {https://rdcu.be/b08Wh},\n  doi     = {10.1038/s41592-019-0686-2},\n}\n"

@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION					,    _KWARGS_DESCRIPTION				)
class     a		(datasets.Metric				):




							"""simple docstring"""


							def    __snake_case (							self	:  Optional[int]    )     ->   Any:
														return datasets.MetricInfo(
														    description=_DESCRIPTION   ,     citation=_CITATION   ,     inputs_description=_KWARGS_DESCRIPTION   ,     features=datasets.Features(
														        {
														            "predictions": datasets.Value("float"    ),
														            "references": datasets.Value("float"    ),
														        }    )   ,     reference_urls=["https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.spearmanr.html"]   ,     )






							def    __snake_case (							self	:  Optional[Any]   ,     lowerCamelCase	:  Optional[int]   ,     lowerCamelCase	:  int   ,     lowerCamelCase	:  Tuple=False    )     ->   Dict:
														__snake_case		:      Optional[int]										=       spearmanr(lowerCamelCase   ,     lowerCamelCase    )
														if return_pvalue:
																					return {"spearmanr": results[0], "spearmanr_pvalue": results[1]}
														else:
																					return {"spearmanr": results[0]}

