diff --git a/edward2/__init__.py b/edward2/__init__.py index 64e7e225..24b3e05e 100644 --- a/edward2/__init__.py +++ b/edward2/__init__.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/jax/__init__.py b/edward2/jax/__init__.py index 4de00704..a5ccd1d8 100644 --- a/edward2/jax/__init__.py +++ b/edward2/jax/__init__.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/jax/nn/__init__.py b/edward2/jax/nn/__init__.py index 8161700b..df6377a1 100644 --- a/edward2/jax/nn/__init__.py +++ b/edward2/jax/nn/__init__.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/jax/nn/attention.py b/edward2/jax/nn/attention.py index 2b0be8b1..b1e6ccb9 100644 --- a/edward2/jax/nn/attention.py +++ b/edward2/jax/nn/attention.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -182,12 +182,12 @@ def f(x, *args, **kwargs): query, key, value, - mask=mask, - dropout_rng=dropout_rng, - dropout_rate=self.dropout_rate, - broadcast_dropout=self.broadcast_dropout, - deterministic=deterministic, - dtype=self.dtype, + mask=mask, # pyrefly: ignore[unexpected-keyword] + dropout_rng=dropout_rng, # pyrefly: ignore[unexpected-keyword] + dropout_rate=self.dropout_rate, # pyrefly: ignore[unexpected-keyword] + broadcast_dropout=self.broadcast_dropout, # pyrefly: ignore[unexpected-keyword] + deterministic=deterministic, # pyrefly: ignore[unexpected-keyword] + dtype=self.dtype, # pyrefly: ignore[unexpected-keyword] precision=self.precision) # pytype: disable=wrong-keyword-args # back to the original inputs dimensions def dense_fn2(name): diff --git a/edward2/jax/nn/attention_test.py b/edward2/jax/nn/attention_test.py index 53506b67..ac26f720 100644 --- a/edward2/jax/nn/attention_test.py +++ b/edward2/jax/nn/attention_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/jax/nn/dense.py b/edward2/jax/nn/dense.py index 71b0fcf8..09bd9028 100644 --- a/edward2/jax/nn/dense.py +++ b/edward2/jax/nn/dense.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/jax/nn/dense_test.py b/edward2/jax/nn/dense_test.py index 717f1099..1632740e 100644 --- a/edward2/jax/nn/dense_test.py +++ b/edward2/jax/nn/dense_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/jax/nn/heteroscedastic_lib.py b/edward2/jax/nn/heteroscedastic_lib.py index 61a8401d..b37bbbc3 100644 --- a/edward2/jax/nn/heteroscedastic_lib.py +++ b/edward2/jax/nn/heteroscedastic_lib.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -257,7 +257,7 @@ def _compute_noise_samples(self, scale, num_samples): def get_temperature(self): if self.tune_temperature: return compute_temperature( - self._pre_sigmoid_temperature, + self._pre_sigmoid_temperature, # pyrefly: ignore[bad-argument-type] lower=self.temperature_lower_bound, upper=self.temperature_upper_bound) else: @@ -510,7 +510,7 @@ def _compute_noise_samples(self, scale, num_samples): def get_temperature(self): if self.tune_temperature: return compute_temperature( - self._pre_sigmoid_temperature, + self._pre_sigmoid_temperature, # pyrefly: ignore[bad-argument-type] lower=self.temperature_lower_bound, upper=self.temperature_upper_bound) else: @@ -609,14 +609,14 @@ def setup(self): self.actual_latent_dim = self.latent_dim if self.parameter_efficient: - self._scale_layer_homoscedastic = dense.DenseBatchEnsemble( + self._scale_layer_homoscedastic = dense.DenseBatchEnsemble( # pyrefly: ignore[bad-assignment] self.actual_latent_dim, ens_size=self.ens_size, alpha_init=self.alpha_init, gamma_init=self.gamma_init, kernel_init=self.kernel_init, name='scale_layer_homoscedastic') - self._scale_layer_heteroscedastic = dense.DenseBatchEnsemble( + self._scale_layer_heteroscedastic = dense.DenseBatchEnsemble( # pyrefly: ignore[bad-assignment] self.actual_latent_dim, ens_size=self.ens_size, alpha_init=self.alpha_init, @@ -624,7 +624,7 @@ def setup(self): kernel_init=self.kernel_init, name='scale_layer_heteroscedastic') elif self.num_factors > 0: - self._scale_layer = dense.DenseBatchEnsemble( + self._scale_layer = dense.DenseBatchEnsemble( # pyrefly: ignore[bad-assignment] self.actual_latent_dim * self.num_factors, ens_size=self.ens_size, alpha_init=self.alpha_init, @@ -632,10 +632,10 @@ def setup(self): kernel_init=self.kernel_init, name='scale_layer') - self._loc_layer = dense.DenseBatchEnsemble(self.num_classes, + self._loc_layer = dense.DenseBatchEnsemble(self.num_classes, # pyrefly: ignore[bad-assignment] ens_size=self.ens_size, name='loc_layer') - self._diag_layer = dense.DenseBatchEnsemble(self.actual_latent_dim, + self._diag_layer = dense.DenseBatchEnsemble(self.actual_latent_dim, # pyrefly: ignore[bad-assignment] ens_size=self.ens_size, name='diag_layer') @@ -664,14 +664,14 @@ def setup(self): self.actual_latent_dim = self.latent_dim if self.parameter_efficient: - self._scale_layer_homoscedastic = dense.DenseBatchEnsemble( + self._scale_layer_homoscedastic = dense.DenseBatchEnsemble( # pyrefly: ignore[bad-assignment] self.actual_latent_dim, ens_size=self.ens_size, alpha_init=self.alpha_init, gamma_init=self.gamma_init, kernel_init=self.kernel_init, name='scale_layer_homoscedastic') - self._scale_layer_heteroscedastic = dense.DenseBatchEnsemble( + self._scale_layer_heteroscedastic = dense.DenseBatchEnsemble( # pyrefly: ignore[bad-assignment] self.actual_latent_dim, ens_size=self.ens_size, alpha_init=self.alpha_init, @@ -679,7 +679,7 @@ def setup(self): kernel_init=self.kernel_init, name='scale_layer_heteroscedastic') elif self.num_factors > 0: - self._scale_layer = dense.DenseBatchEnsemble( + self._scale_layer = dense.DenseBatchEnsemble( # pyrefly: ignore[bad-assignment] self.actual_latent_dim * self.num_factors, ens_size=self.ens_size, alpha_init=self.alpha_init, @@ -687,13 +687,13 @@ def setup(self): kernel_init=self.kernel_init, name='scale_layer') - self._loc_layer = dense.DenseBatchEnsemble(self.num_outputs, + self._loc_layer = dense.DenseBatchEnsemble(self.num_outputs, # pyrefly: ignore[bad-assignment] ens_size=self.ens_size, alpha_init=self.alpha_init, gamma_init=self.gamma_init, kernel_init=self.kernel_init, name='loc_layer') - self._diag_layer = dense.DenseBatchEnsemble(self.actual_latent_dim, + self._diag_layer = dense.DenseBatchEnsemble(self.actual_latent_dim, # pyrefly: ignore[bad-assignment] ens_size=self.ens_size, alpha_init=self.alpha_init, gamma_init=self.gamma_init, diff --git a/edward2/jax/nn/normalization.py b/edward2/jax/nn/normalization.py index 2448ffa4..4138fbb4 100644 --- a/edward2/jax/nn/normalization.py +++ b/edward2/jax/nn/normalization.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -187,7 +187,7 @@ def scan_body(carry, _): class SpectralNormalizationConv2D(SpectralNormalization): __doc__ = "Implements spectral normalization for Conv layers based on [2].\n" + "\n".join( - SpectralNormalization.__doc__.split("\n")[1:]) + SpectralNormalization.__doc__.split("\n")[1:]) # pyrefly: ignore[missing-attribute] kernel_apply_kwargs: Mapping[str, Any] = flax.core.FrozenDict( feature_group_count=1, padding="SAME", use_bias=False) @@ -208,8 +208,8 @@ def _abs_sq(x): # promote x to at least float32, this avoids half precision computation # but preserves double or complex floating points x = jnp.asarray(x, jnp.promote_types(jnp.float32, jnp.result_type(x))) - mean = jnp.mean(x, axes) - mean2 = jnp.mean(_abs_sq(x), axes) + mean = jnp.mean(x, axes) # pyrefly: ignore[bad-argument-type] + mean2 = jnp.mean(_abs_sq(x), axes) # pyrefly: ignore[bad-argument-type] if axis_name is not None: concatenated_mean = jnp.concatenate([mean, mean2]) mean, mean2 = jnp.split( diff --git a/edward2/jax/nn/normalization_test.py b/edward2/jax/nn/normalization_test.py index f2e1e77b..310398c9 100644 --- a/edward2/jax/nn/normalization_test.py +++ b/edward2/jax/nn/normalization_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/jax/nn/random_feature.py b/edward2/jax/nn/random_feature.py index d79ad894..c8277d06 100644 --- a/edward2/jax/nn/random_feature.py +++ b/edward2/jax/nn/random_feature.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -211,7 +211,7 @@ def __call__(self, inputs: Array) -> Array: (contracting_dims, batch_dims)) outputs = outputs + jnp.broadcast_to(bias.value, outputs.shape) - return self._feature_scale * self.activation(outputs) + return self._feature_scale * self.activation(outputs) # pyrefly: ignore[unsupported-operation] class LaplaceRandomFeatureCovariance(nn.Module): @@ -340,10 +340,10 @@ def update_precision_matrix(self, gp_features: Array, # Computes precision matrix within new batch. if self.likelihood == 'binary_logistic': - prob = nn.sigmoid(gp_logits) + prob = nn.sigmoid(gp_logits) # pyrefly: ignore[bad-argument-type] prob_multiplier = prob * (1. - prob) elif self.likelihood == 'poisson': - prob_multiplier = jnp.exp(gp_logits) + prob_multiplier = jnp.exp(gp_logits) # pyrefly: ignore[bad-argument-type] else: prob_multiplier = 1. @@ -703,16 +703,16 @@ class MCSigmoidDenseFASNGPBE(MCSigmoidDenseFASNGP): def setup(self): if self.parameter_efficient: - self._scale_layer_homoscedastic = dense.DenseBatchEnsemble( + self._scale_layer_homoscedastic = dense.DenseBatchEnsemble( # pyrefly: ignore[bad-assignment] self.num_outputs, ens_size=self.ens_size, name='scale_layer_homoscedastic') - self._scale_layer_heteroscedastic = dense.DenseBatchEnsemble( + self._scale_layer_heteroscedastic = dense.DenseBatchEnsemble( # pyrefly: ignore[bad-assignment] self.num_outputs, ens_size=self.ens_size, name='scale_layer_heteroscedastic') elif self.num_factors > 0: - self._scale_layer = dense.DenseBatchEnsemble( + self._scale_layer = dense.DenseBatchEnsemble( # pyrefly: ignore[bad-assignment] self.num_outputs * self.num_factors, ens_size=self.ens_size, name='scale_layer') @@ -726,6 +726,6 @@ def setup(self): output_kwargs=self.output_kwargs, covmat_kwargs=self.covmat_kwargs, name='loc_layer') - self._diag_layer = dense.DenseBatchEnsemble(self.num_outputs, + self._diag_layer = dense.DenseBatchEnsemble(self.num_outputs, # pyrefly: ignore[bad-assignment] ens_size=self.ens_size, name='diag_layer') diff --git a/edward2/jax/nn/random_feature_test.py b/edward2/jax/nn/random_feature_test.py index ef94cfd6..8e057b0f 100644 --- a/edward2/jax/nn/random_feature_test.py +++ b/edward2/jax/nn/random_feature_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/jax/nn/utils.py b/edward2/jax/nn/utils.py index 22ad70ed..75418ad4 100644 --- a/edward2/jax/nn/utils.py +++ b/edward2/jax/nn/utils.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/jax/nn/utils_test.py b/edward2/jax/nn/utils_test.py index 4509ed24..4160b40f 100644 --- a/edward2/jax/nn/utils_test.py +++ b/edward2/jax/nn/utils_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/maps.py b/edward2/maps.py index 07055ad3..e3a70d4c 100644 --- a/edward2/maps.py +++ b/edward2/maps.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ @overload -def robust_map( +def robust_map( # pyrefly: ignore[inconsistent-overload] fn: Callable[[T], U], inputs: Sequence[T], error_output: V = ..., @@ -45,7 +45,7 @@ def robust_map( @overload -def robust_map( +def robust_map( # pyrefly: ignore[inconsistent-overload] fn: Callable[[T], U], inputs: Sequence[T], error_output: V = ..., @@ -61,7 +61,7 @@ def robust_map( @overload -def robust_map( +def robust_map( # pyrefly: ignore[inconsistent-overload] fn: Callable[[T], U], inputs: Sequence[T], error_output: V = ..., @@ -77,7 +77,7 @@ def robust_map( @overload -def robust_map( +def robust_map( # pyrefly: ignore[inconsistent-overload] fn: Callable[[T], U], inputs: Sequence[T], error_output: V = ..., diff --git a/edward2/maps_test.py b/edward2/maps_test.py index f35e365c..4064a9d4 100644 --- a/edward2/maps_test.py +++ b/edward2/maps_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/numpy/__init__.py b/edward2/numpy/__init__.py index 4f7b1d57..99ead0f7 100644 --- a/edward2/numpy/__init__.py +++ b/edward2/numpy/__init__.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/numpy/generated_random_variables.py b/edward2/numpy/generated_random_variables.py index ce6f330a..727ad19b 100644 --- a/edward2/numpy/generated_random_variables.py +++ b/edward2/numpy/generated_random_variables.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ scipy.stats.rv_discrete, scipy.stats.rv_histogram)): if hasattr(candidate, 'rvs'): - candidate.rvs = traceable(candidate.rvs) + candidate.rvs = traceable(candidate.rvs) # pyrefly: ignore[missing-attribute] _globals[candidate_name] = candidate __all__.append(candidate_name) diff --git a/edward2/numpy/generated_random_variables_test.py b/edward2/numpy/generated_random_variables_test.py index af25c6f6..c6c22643 100644 --- a/edward2/numpy/generated_random_variables_test.py +++ b/edward2/numpy/generated_random_variables_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/numpy/program_transformations.py b/edward2/numpy/program_transformations.py index 648bcb81..f2f04eda 100644 --- a/edward2/numpy/program_transformations.py +++ b/edward2/numpy/program_transformations.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -124,7 +124,7 @@ def tracer(rv_call, *rv_args, **rv_kwargs): rv_kwargs.pop("size", None) rv_kwargs.pop("random_state", None) rv_kwargs.pop("name", None) - log_prob = np.sum(log_prob_fn(cls(), value, *rv_args, **rv_kwargs)) + log_prob = np.sum(log_prob_fn(cls(), value, *rv_args, **rv_kwargs)) # pyrefly: ignore[not-callable] log_probs.append(log_prob) return value diff --git a/edward2/numpy/program_transformations_test.py b/edward2/numpy/program_transformations_test.py index ecbaf6b8..ce7f8858 100644 --- a/edward2/numpy/program_transformations_test.py +++ b/edward2/numpy/program_transformations_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/__init__.py b/edward2/tensorflow/__init__.py index 03fd052c..6cc2053c 100644 --- a/edward2/tensorflow/__init__.py +++ b/edward2/tensorflow/__init__.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/constraints.py b/edward2/tensorflow/constraints.py index e52f3587..f1542bb1 100644 --- a/edward2/tensorflow/constraints.py +++ b/edward2/tensorflow/constraints.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/constraints_test.py b/edward2/tensorflow/constraints_test.py index 3f02fa40..26770995 100644 --- a/edward2/tensorflow/constraints_test.py +++ b/edward2/tensorflow/constraints_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/generated_random_variables.py b/edward2/tensorflow/generated_random_variables.py index ad9eaf48..13296bbb 100644 --- a/edward2/tensorflow/generated_random_variables.py +++ b/edward2/tensorflow/generated_random_variables.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/generated_random_variables_test.py b/edward2/tensorflow/generated_random_variables_test.py index 2240b044..07cd7622 100644 --- a/edward2/tensorflow/generated_random_variables_test.py +++ b/edward2/tensorflow/generated_random_variables_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/initializers.py b/edward2/tensorflow/initializers.py index 775192ee..8ccdfd20 100644 --- a/edward2/tensorflow/initializers.py +++ b/edward2/tensorflow/initializers.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -189,7 +189,7 @@ def __init__(self, self.loc_constraint = constraints.get(loc_constraint) self.seed = seed - def build(self, shape, dtype=None): + def build(self, shape, dtype=None): # pyrefly: ignore[bad-override] if dtype is None: dtype = self.dtype @@ -209,8 +209,8 @@ def __call__(self, shape, dtype=None): loc = self.loc if self.loc_constraint: loc = self.loc_constraint(loc) - return generated_random_variables.Independent( - generated_random_variables.Deterministic(loc=loc).distribution, + return generated_random_variables.Independent( # pyrefly: ignore[missing-attribute] + generated_random_variables.Deterministic(loc=loc).distribution, # pyrefly: ignore[missing-attribute] reinterpreted_batch_ndims=len(shape)) def get_config(self): @@ -249,7 +249,7 @@ def __init__(self, self.scale_constraint = constraints.get(scale_constraint) self.seed = seed - def build(self, shape, dtype=None): + def build(self, shape, dtype=None): # pyrefly: ignore[bad-override] if dtype is None: dtype = self.dtype @@ -280,8 +280,8 @@ def __call__(self, shape, dtype=None): scale = self.scale if self.scale_constraint: scale = self.scale_constraint(scale) - return generated_random_variables.Independent( - generated_random_variables.HalfCauchy(loc=loc, + return generated_random_variables.Independent( # pyrefly: ignore[missing-attribute] + generated_random_variables.HalfCauchy(loc=loc, # pyrefly: ignore[missing-attribute] scale=scale).distribution, reinterpreted_batch_ndims=len(shape)) @@ -327,7 +327,7 @@ def __init__( self.scale_constraint = constraints.get(scale_constraint) self.seed = seed - def build(self, shape, dtype=None): + def build(self, shape, dtype=None): # pyrefly: ignore[bad-override] if dtype is None: dtype = self.dtype @@ -358,8 +358,8 @@ def __call__(self, shape, dtype=None): scale = self.scale if self.scale_constraint: scale = self.scale_constraint(scale) - return generated_random_variables.Independent( - generated_random_variables.Cauchy(loc=loc, scale=scale).distribution, + return generated_random_variables.Independent( # pyrefly: ignore[missing-attribute] + generated_random_variables.Cauchy(loc=loc, scale=scale).distribution, # pyrefly: ignore[missing-attribute] reinterpreted_batch_ndims=len(shape)) def get_config(self): @@ -398,7 +398,7 @@ def __init__(self, self.scale_constraint = constraints.get(scale_constraint) self.seed = seed - def build(self, shape, dtype=None): + def build(self, shape, dtype=None): # pyrefly: ignore[bad-override] if dtype is None: dtype = self.dtype @@ -429,8 +429,8 @@ def __call__(self, shape, dtype=None): scale = self.scale if self.scale_constraint: scale = self.scale_constraint(scale) - return generated_random_variables.Independent( - generated_random_variables.LogNormal(loc=loc, scale=scale).distribution, + return generated_random_variables.Independent( # pyrefly: ignore[missing-attribute] + generated_random_variables.LogNormal(loc=loc, scale=scale).distribution, # pyrefly: ignore[missing-attribute] reinterpreted_batch_ndims=len(shape)) def get_config(self): @@ -475,7 +475,7 @@ def __init__(self, self.stddev_constraint = constraints.get(stddev_constraint) self.seed = seed - def build(self, shape, dtype=None): + def build(self, shape, dtype=None): # pyrefly: ignore[bad-override] if dtype is None: dtype = self.dtype @@ -506,8 +506,8 @@ def __call__(self, shape, dtype=None): stddev = self.stddev if self.stddev_constraint: stddev = self.stddev_constraint(stddev) - return generated_random_variables.Independent( - generated_random_variables.Normal(loc=mean, scale=stddev).distribution, + return generated_random_variables.Independent( # pyrefly: ignore[missing-attribute] + generated_random_variables.Normal(loc=mean, scale=stddev).distribution, # pyrefly: ignore[missing-attribute] reinterpreted_batch_ndims=len(shape)) def get_config(self): @@ -630,7 +630,7 @@ def __init__(self, self.mean_constraint = constraints.get(mean_constraint) self.seed = seed - def build(self, shape, dtype=None): + def build(self, shape, dtype=None): # pyrefly: ignore[bad-override] if dtype is None: dtype = self.dtype self.mean = self.add_weight( @@ -649,8 +649,8 @@ def __call__(self, shape, dtype=None): mean = self.mean if self.mean_constraint: mean = self.mean_constraint(mean) - return generated_random_variables.Independent( - generated_random_variables.Normal(loc=mean, + return generated_random_variables.Independent( # pyrefly: ignore[missing-attribute] + generated_random_variables.Normal(loc=mean, # pyrefly: ignore[missing-attribute] scale=self.stddev).distribution, reinterpreted_batch_ndims=len(shape)) @@ -712,7 +712,7 @@ def __init__(self, self.loc_constraint = constraints.get(loc_constraint) self.seed = seed - def build(self, shape, dtype=None): + def build(self, shape, dtype=None): # pyrefly: ignore[bad-override] if dtype is None: dtype = self.dtype @@ -732,13 +732,13 @@ def __call__(self, shape, dtype=None): loc = self.loc if self.loc_constraint: loc = self.loc_constraint(loc) - return generated_random_variables.Independent( - generated_random_variables.MixtureSameFamily( - mixture_distribution=generated_random_variables.Categorical( + return generated_random_variables.Independent( # pyrefly: ignore[missing-attribute] + generated_random_variables.MixtureSameFamily( # pyrefly: ignore[missing-attribute] + mixture_distribution=generated_random_variables.Categorical( # pyrefly: ignore[missing-attribute] probs=tf.broadcast_to( [[1/self.num_components]*self.num_components], list(shape) + [self.num_components])).distribution, - components_distribution=generated_random_variables.Deterministic( + components_distribution=generated_random_variables.Deterministic( # pyrefly: ignore[missing-attribute] loc=loc).distribution ).distribution, reinterpreted_batch_ndims=len(shape)) diff --git a/edward2/tensorflow/initializers_test.py b/edward2/tensorflow/initializers_test.py index f741d6ec..9151fa29 100644 --- a/edward2/tensorflow/initializers_test.py +++ b/edward2/tensorflow/initializers_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/__init__.py b/edward2/tensorflow/layers/__init__.py index 9e5016dc..a50bc414 100644 --- a/edward2/tensorflow/layers/__init__.py +++ b/edward2/tensorflow/layers/__init__.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/bayesian_linear_model.py b/edward2/tensorflow/layers/bayesian_linear_model.py index 15231f9f..d6e36222 100644 --- a/edward2/tensorflow/layers/bayesian_linear_model.py +++ b/edward2/tensorflow/layers/bayesian_linear_model.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -54,11 +54,11 @@ def call(self, inputs): # pytype: disable=signature-mismatch # overriding-para predictive_mean = tf.einsum('nm,m->n', inputs, self.coeffs_mean) predictive_covariance = tf.matmul( inputs, - self.coeffs_precision_tril_op.solve( - self.coeffs_precision_tril_op.solve(inputs, adjoint_arg=True), + self.coeffs_precision_tril_op.solve( # pyrefly: ignore[missing-attribute] + self.coeffs_precision_tril_op.solve(inputs, adjoint_arg=True), # pyrefly: ignore[missing-attribute] adjoint=True)) predictive_variance = tf.linalg.tensor_diag_part(predictive_covariance) - return generated_random_variables.Normal(loc=predictive_mean, + return generated_random_variables.Normal(loc=predictive_mean, # pyrefly: ignore[missing-attribute] scale=tf.sqrt(predictive_variance)) def fit(self, x=None, y=None): # pytype: disable=signature-mismatch # overriding-parameter-count-checks diff --git a/edward2/tensorflow/layers/bayesian_linear_model_test.py b/edward2/tensorflow/layers/bayesian_linear_model_test.py index 36ea59d1..469afc81 100644 --- a/edward2/tensorflow/layers/bayesian_linear_model_test.py +++ b/edward2/tensorflow/layers/bayesian_linear_model_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/convolutional.py b/edward2/tensorflow/layers/convolutional.py index eca807d9..4558583b 100644 --- a/edward2/tensorflow/layers/convolutional.py +++ b/edward2/tensorflow/layers/convolutional.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -86,9 +86,9 @@ def __init__(self, def call_weights(self): """Calls any weights if the initializer is itself a layer.""" if isinstance(self.kernel_initializer, tf.keras.layers.Layer): - self.kernel = self.kernel_initializer(self.kernel.shape, self.dtype) + self.kernel = self.kernel_initializer(self.kernel.shape, self.dtype) # pyrefly: ignore[not-callable] if isinstance(self.bias_initializer, tf.keras.layers.Layer): - self.bias = self.bias_initializer(self.bias.shape, self.dtype) + self.bias = self.bias_initializer(self.bias.shape, self.dtype) # pyrefly: ignore[missing-attribute, not-callable] def call(self, *args, **kwargs): self.call_weights() @@ -154,9 +154,9 @@ def __init__(self, def call_weights(self): """Calls any weights if the initializer is itself a layer.""" if isinstance(self.kernel_initializer, tf.keras.layers.Layer): - self.kernel = self.kernel_initializer(self.kernel.shape, self.dtype) + self.kernel = self.kernel_initializer(self.kernel.shape, self.dtype) # pyrefly: ignore[not-callable] if isinstance(self.bias_initializer, tf.keras.layers.Layer): - self.bias = self.bias_initializer(self.bias.shape, self.dtype) + self.bias = self.bias_initializer(self.bias.shape, self.dtype) # pyrefly: ignore[missing-attribute, not-callable] def call(self, *args, **kwargs): self.call_weights() @@ -434,10 +434,10 @@ def build(self, input_shape): def call_weights(self): """Calls any weights if the initializer is itself a layer.""" if isinstance(self.local_scale_initializer, tf.keras.layers.Layer): - self.local_scale = self.local_scale_initializer(self.local_scale.shape, + self.local_scale = self.local_scale_initializer(self.local_scale.shape, # pyrefly: ignore[not-callable] self.dtype) if isinstance(self.global_scale_initializer, tf.keras.layers.Layer): - self.global_scale = self.global_scale_initializer(self.global_scale.shape, + self.global_scale = self.global_scale_initializer(self.global_scale.shape, # pyrefly: ignore[not-callable] self.dtype) super().call_weights() @@ -538,7 +538,7 @@ def dropped_inputs(): means = tf.nn.bias_add(means, self.bias, data_format='NCHW') else: means = tf.nn.bias_add(means, self.bias, data_format='NHWC') - outputs = generated_random_variables.Normal(loc=means, scale=stddevs) + outputs = generated_random_variables.Normal(loc=means, scale=stddevs) # pyrefly: ignore[missing-attribute] if self.activation is not None: outputs = self.activation(outputs) return outputs @@ -618,10 +618,10 @@ def build(self, input_shape): input_channel = input_shape[-1] if self.rank > 1: - alpha_shape = [self.rank, self.ensemble_size, input_channel] + alpha_shape = [self.rank, self.ensemble_size, input_channel] # pyrefly: ignore[unbound-name] gamma_shape = [self.rank, self.ensemble_size, self.filters] else: - alpha_shape = [self.ensemble_size, input_channel] + alpha_shape = [self.ensemble_size, input_channel] # pyrefly: ignore[unbound-name] gamma_shape = [self.ensemble_size, self.filters] self.alpha = self.add_weight( 'alpha', @@ -789,7 +789,7 @@ def build(self, input_shape): self.alpha = self.add_weight( 'alpha', - shape=[self.ensemble_size, input_channel], + shape=[self.ensemble_size, input_channel], # pyrefly: ignore[unbound-name] initializer=self.alpha_initializer, trainable=True, dtype=self.dtype) @@ -1060,7 +1060,7 @@ def build(self, input_shape): elif self.data_format == 'channels_last': input_channel = input_shape[-1] - alpha_shape = [self.ensemble_size, input_channel] + alpha_shape = [self.ensemble_size, input_channel] # pyrefly: ignore[unbound-name] gamma_shape = [self.ensemble_size, self.filters] self.conv2d.alpha = self._add_weight('alpha', alpha_shape) @@ -1772,7 +1772,7 @@ def build(self, input_shape): elif self.data_format == 'channels_last': input_channel = input_shape[-1] - filters = input_channel * self.depth_multiplier + filters = input_channel * self.depth_multiplier # pyrefly: ignore[unbound-name] self.alpha = self.add_weight( 'alpha', shape=[self.ensemble_size, input_channel], @@ -1934,7 +1934,7 @@ def build(self, input_shape): self.alpha = self.add_weight( 'alpha', - shape=[self.ensemble_size, input_channel], + shape=[self.ensemble_size, input_channel], # pyrefly: ignore[unbound-name] initializer=self.alpha_initializer, regularizer=self.alpha_regularizer, constraint=self.alpha_constraint, @@ -1974,7 +1974,7 @@ def call(self, inputs): # Sample parameters for each example. if isinstance(self.alpha_initializer, tf.keras.layers.Layer): alpha = tf.clip_by_value( - self.alpha_initializer( + self.alpha_initializer( # pyrefly: ignore[not-callable] self.alpha_shape, self.dtype).distribution.sample(examples_per_model), self.min_perturbation_value, @@ -1984,7 +1984,7 @@ def call(self, inputs): alpha = tf.tile(self.alpha, [1, examples_per_model]) if isinstance(self.gamma_initializer, tf.keras.layers.Layer): gamma = tf.clip_by_value( - self.gamma_initializer( + self.gamma_initializer( # pyrefly: ignore[not-callable] self.gamma_shape, self.dtype).distribution.sample(examples_per_model), self.min_perturbation_value, @@ -2005,7 +2005,7 @@ def call(self, inputs): if self.use_ensemble_bias: if isinstance(self.ensemble_bias_initializer, tf.keras.layers.Layer): - bias = self.ensemble_bias_initializer( + bias = self.ensemble_bias_initializer( # pyrefly: ignore[not-callable] self.ensemble_bias_shape, self.dtype).distribution.sample(examples_per_model) bias = tf.transpose(bias, [1, 0, 2]) @@ -2139,7 +2139,7 @@ def build(self, input_shape): self.alpha = self.add_weight( 'alpha', - shape=[self.ensemble_size, input_channel], + shape=[self.ensemble_size, input_channel], # pyrefly: ignore[unbound-name] initializer=self.alpha_initializer, regularizer=self.alpha_regularizer, constraint=self.alpha_constraint, @@ -2179,7 +2179,7 @@ def call(self, inputs): # Sample parameters for each example. if isinstance(self.alpha_initializer, tf.keras.layers.Layer): alpha = tf.clip_by_value( - self.alpha_initializer( + self.alpha_initializer( # pyrefly: ignore[not-callable] self.alpha_shape, self.dtype).distribution.sample(examples_per_model), self.min_perturbation_value, @@ -2189,7 +2189,7 @@ def call(self, inputs): alpha = tf.tile(self.alpha, [1, examples_per_model]) if isinstance(self.gamma_initializer, tf.keras.layers.Layer): gamma = tf.clip_by_value( - self.gamma_initializer( + self.gamma_initializer( # pyrefly: ignore[not-callable] self.gamma_shape, self.dtype).distribution.sample(examples_per_model), self.min_perturbation_value, @@ -2212,7 +2212,7 @@ def call(self, inputs): if self.use_ensemble_bias: if isinstance(self.ensemble_bias_initializer, tf.keras.layers.Layer): - bias = self.ensemble_bias_initializer( + bias = self.ensemble_bias_initializer( # pyrefly: ignore[not-callable] self.ensemble_bias_shape, self.dtype).distribution.sample(examples_per_model) bias = tf.transpose(bias, [1, 0, 2]) diff --git a/edward2/tensorflow/layers/convolutional_test.py b/edward2/tensorflow/layers/convolutional_test.py index 82717152..5349dea7 100644 --- a/edward2/tensorflow/layers/convolutional_test.py +++ b/edward2/tensorflow/layers/convolutional_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/dense.py b/edward2/tensorflow/layers/dense.py index 56b827a2..12472721 100644 --- a/edward2/tensorflow/layers/dense.py +++ b/edward2/tensorflow/layers/dense.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -73,9 +73,9 @@ def __init__(self, def call_weights(self): """Calls any weights if the initializer is itself a layer.""" if isinstance(self.kernel_initializer, tf.keras.layers.Layer): - self.kernel = self.kernel_initializer(self.kernel.shape, self.dtype) + self.kernel = self.kernel_initializer(self.kernel.shape, self.dtype) # pyrefly: ignore[not-callable] if isinstance(self.bias_initializer, tf.keras.layers.Layer): - self.bias = self.bias_initializer(self.bias.shape, self.dtype) + self.bias = self.bias_initializer(self.bias.shape, self.dtype) # pyrefly: ignore[not-callable] def call(self, *args, **kwargs): self.call_weights() @@ -144,7 +144,7 @@ def call(self, inputs): # E[outputs] = E[inputs] * E[kernel] + E[bias] mean = tf.tensordot(inputs_mean, kernel_mean, [[-1], [0]]) if self.use_bias: - mean = tf.nn.bias_add(mean, bias_mean) + mean = tf.nn.bias_add(mean, bias_mean) # pyrefly: ignore[unbound-name] # Cov = E[inputs**2] Cov(kernel) + E[W]^T Cov(inputs) E[W] + Cov(bias) # For first term, assume Cov(kernel) = 0 on off-diagonals so we only @@ -158,7 +158,7 @@ def call(self, inputs): w_cov_w = tf.tensordot(cov_w, kernel_mean, [[-2], [0]]) covariance = w_cov_w if self.use_bias: - covariance += bias_covariance + covariance += bias_covariance # pyrefly: ignore[unbound-name] covariance = tf.linalg.set_diag( covariance, tf.linalg.diag_part(covariance) + covariance_diag) @@ -198,7 +198,7 @@ def call(self, inputs): 'inference is only available if activation is ' 'ReLU or None.'.format(self.activation)) - return generated_random_variables.MultivariateNormalFullCovariance( + return generated_random_variables.MultivariateNormalFullCovariance( # pyrefly: ignore[missing-attribute] mean, covariance) @@ -345,7 +345,7 @@ def dropped_inputs(): tf.keras.backend.epsilon()) if self.use_bias: means = tf.nn.bias_add(means, self.bias) - outputs = generated_random_variables.Normal(loc=means, scale=stddevs) + outputs = generated_random_variables.Normal(loc=means, scale=stddevs) # pyrefly: ignore[missing-attribute] if self.activation is not None: outputs = self.activation(outputs) return outputs @@ -452,10 +452,10 @@ def build(self, input_shape): def call_weights(self): """Calls any weights if the initializer is itself a layer.""" if isinstance(self.local_scale_initializer, tf.keras.layers.Layer): - self.local_scale = self.local_scale_initializer(self.local_scale.shape, + self.local_scale = self.local_scale_initializer(self.local_scale.shape, # pyrefly: ignore[not-callable] self.dtype) if isinstance(self.global_scale_initializer, tf.keras.layers.Layer): - self.global_scale = self.global_scale_initializer(self.global_scale.shape, + self.global_scale = self.global_scale_initializer(self.global_scale.shape, # pyrefly: ignore[not-callable] self.dtype) super().call_weights() @@ -808,8 +808,8 @@ def call(self, inputs): data, lambdas, e = inputs e1, e2 = e[:, :self.units], e[:, self.units:] - output = self.dense(data) - delta_kernel = self.delta_dense(data) * e1 + output = self.dense(data) # pyrefly: ignore[not-callable] + delta_kernel = self.delta_dense(data) * e1 # pyrefly: ignore[not-callable] output += delta_kernel batch_size = tf.shape(data)[0] @@ -1104,7 +1104,7 @@ def call(self, inputs): # Sample parameters for each example. if isinstance(self.alpha_initializer, tf.keras.layers.Layer): alpha = tf.clip_by_value( - self.alpha_initializer( + self.alpha_initializer( # pyrefly: ignore[not-callable] self.alpha_shape, self.dtype).distribution.sample(examples_per_model), self.min_perturbation_value, @@ -1114,7 +1114,7 @@ def call(self, inputs): alpha = tf.expand_dims(self.alpha, 1) if isinstance(self.gamma_initializer, tf.keras.layers.Layer): gamma = tf.clip_by_value( - self.gamma_initializer( + self.gamma_initializer( # pyrefly: ignore[not-callable] self.gamma_shape, self.dtype).distribution.sample(examples_per_model), self.min_perturbation_value, @@ -1130,7 +1130,7 @@ def call(self, inputs): if self.use_ensemble_bias: if isinstance(self.ensemble_bias_initializer, tf.keras.layers.Layer): - bias = self.ensemble_bias_initializer( + bias = self.ensemble_bias_initializer( # pyrefly: ignore[not-callable] self.ensemble_bias_shape, self.dtype).distribution.sample(examples_per_model) bias = tf.transpose(bias, [1, 0, 2]) diff --git a/edward2/tensorflow/layers/dense_test.py b/edward2/tensorflow/layers/dense_test.py index 6fb04c00..5f22af6c 100644 --- a/edward2/tensorflow/layers/dense_test.py +++ b/edward2/tensorflow/layers/dense_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/discrete_flows.py b/edward2/tensorflow/layers/discrete_flows.py index 2f90a413..4d277a36 100644 --- a/edward2/tensorflow/layers/discrete_flows.py +++ b/edward2/tensorflow/layers/discrete_flows.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/discrete_flows_test.py b/edward2/tensorflow/layers/discrete_flows_test.py index 3082e8c8..7a7eb509 100644 --- a/edward2/tensorflow/layers/discrete_flows_test.py +++ b/edward2/tensorflow/layers/discrete_flows_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/embeddings.py b/edward2/tensorflow/layers/embeddings.py index 2e62d49f..4ebdc07d 100644 --- a/edward2/tensorflow/layers/embeddings.py +++ b/edward2/tensorflow/layers/embeddings.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -92,7 +92,7 @@ def __init__(self, def call_weights(self): """Calls any weights if the initializer is itself a layer.""" if isinstance(self.embeddings_initializer, tf.keras.layers.Layer): - self.embeddings = self.embeddings_initializer(self.embeddings.shape, + self.embeddings = self.embeddings_initializer(self.embeddings.shape, # pyrefly: ignore[not-callable] self.dtype) def call(self, *args, **kwargs): diff --git a/edward2/tensorflow/layers/embeddings_test.py b/edward2/tensorflow/layers/embeddings_test.py index 5a0f8229..9daa6b14 100644 --- a/edward2/tensorflow/layers/embeddings_test.py +++ b/edward2/tensorflow/layers/embeddings_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/gaussian_process.py b/edward2/tensorflow/layers/gaussian_process.py index fdd3fc12..c6f5626b 100644 --- a/edward2/tensorflow/layers/gaussian_process.py +++ b/edward2/tensorflow/layers/gaussian_process.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -222,9 +222,9 @@ def call(self, inputs): # event_shape batch_size. Then make it be independent across the units # dimension. Then transpose its dimensions so it is [batch_size, units]. random_variable = ( - generated_random_variables.MultivariateNormalFullCovariance( + generated_random_variables.MultivariateNormalFullCovariance( # pyrefly: ignore[missing-attribute] loc=loc, covariance_matrix=covariance_matrix)) - random_variable = generated_random_variables.Independent( + random_variable = generated_random_variables.Independent( # pyrefly: ignore[missing-attribute] random_variable.distribution, reinterpreted_batch_ndims=1) bijector = tfp.bijectors.Inline( forward_fn=lambda x: tf.transpose(x, perm=[1, 0]), @@ -233,7 +233,7 @@ def call(self, inputs): forward_event_shape_tensor_fn=lambda input_shape: input_shape[::-1], inverse_log_det_jacobian_fn=lambda y: tf.cast(0, y.dtype), forward_min_event_ndims=2) - random_variable = generated_random_variables.TransformedDistribution( + random_variable = generated_random_variables.TransformedDistribution( # pyrefly: ignore[missing-attribute] random_variable.distribution, bijector=bijector) return random_variable @@ -407,11 +407,11 @@ def call_weights(self): """Calls any weights if the initializer is itself a layer.""" if isinstance(self.inducing_inputs_initializer, tf.keras.layers.Layer): assert self.conditional_inputs is not None - self.conditional_inputs = self.inducing_inputs_initializer( + self.conditional_inputs = self.inducing_inputs_initializer( # pyrefly: ignore[not-callable] self.conditional_inputs.shape, self.dtype) if isinstance(self.inducing_outputs_initializer, tf.keras.layers.Layer): assert self.conditional_outputs is not None - self.conditional_outputs = self.inducing_outputs_initializer( + self.conditional_outputs = self.inducing_outputs_initializer( # pyrefly: ignore[not-callable] self.conditional_outputs.shape, self.dtype) def call(self, inputs): diff --git a/edward2/tensorflow/layers/gaussian_process_test.py b/edward2/tensorflow/layers/gaussian_process_test.py index b244c8e1..b1b1ae79 100644 --- a/edward2/tensorflow/layers/gaussian_process_test.py +++ b/edward2/tensorflow/layers/gaussian_process_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/heteroscedastic.py b/edward2/tensorflow/layers/heteroscedastic.py index 59244380..69b819c2 100644 --- a/edward2/tensorflow/layers/heteroscedastic.py +++ b/edward2/tensorflow/layers/heteroscedastic.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -303,7 +303,7 @@ def call(self, inputs, training=True, seed=None): if seed is not None: raise ValueError('Seed should not be provided when running in graph ' 'mode, but %s was provided.' % seed) - with tf.name_scope(self._name): + with tf.name_scope(self._name): # pyrefly: ignore[bad-instantiation] locs = self._compute_loc_param(inputs) # pylint: disable=assignment-from-none scale = self._compute_scale_param(inputs) # pylint: disable=assignment-from-none @@ -482,7 +482,7 @@ def _compute_loc_param(self, inputs): Returns: Tensor of shape [batch_size, num_classes]. """ - return self._loc_layer(inputs) + return self._loc_layer(inputs) # pyrefly: ignore[not-callable] def _compute_scale_param(self, inputs): """Computes scale parameter of the "logits distribution". @@ -493,7 +493,7 @@ def _compute_scale_param(self, inputs): Returns: Tensor of shape [batch_size, num_classes]. """ - return self._scale_layer(inputs) + MIN_SCALE_MONTE_CARLO + return self._scale_layer(inputs) + MIN_SCALE_MONTE_CARLO # pyrefly: ignore[not-callable] def get_config(self): config = { @@ -655,7 +655,7 @@ def _compute_loc_param(self, inputs): Returns: Tensor of shape [batch_size, num_classes]. """ - return self._loc_layer(inputs) + return self._loc_layer(inputs) # pyrefly: ignore[not-callable] def _compute_scale_param(self, inputs): """Computes scale parameter of the "logits distribution". @@ -668,10 +668,10 @@ def _compute_scale_param(self, inputs): [batch_size, num_classes]). """ if self._parameter_efficient: - return (inputs, self._diag_layer(inputs) + MIN_SCALE_MONTE_CARLO) + return (inputs, self._diag_layer(inputs) + MIN_SCALE_MONTE_CARLO) # pyrefly: ignore[not-callable] else: - return (self._scale_layer(inputs), - self._diag_layer(inputs) + MIN_SCALE_MONTE_CARLO) + return (self._scale_layer(inputs), # pyrefly: ignore[not-callable] + self._diag_layer(inputs) + MIN_SCALE_MONTE_CARLO) # pyrefly: ignore[not-callable] def _compute_diagonal_noise_samples(self, diag_scale, num_samples, seed): """Compute samples of the diagonal elements logit noise. @@ -772,9 +772,9 @@ def _compute_noise_samples(self, scale, num_samples, seed): factor_loadings, num_samples, seed) if self._parameter_efficient: - res = self._scale_layer_homoscedastic(standard_normal_samples) + res = self._scale_layer_homoscedastic(standard_normal_samples) # pyrefly: ignore[not-callable] res *= tf.expand_dims( - self._scale_layer_heteroscedastic(factor_loadings), 1) + self._scale_layer_heteroscedastic(factor_loadings), 1) # pyrefly: ignore[not-callable] else: # reshape scale vector into factor loadings matrix factor_loadings = tf.reshape(factor_loadings, @@ -957,7 +957,7 @@ def _compute_mc_samples(self, locs, scale, num_samples, seed): locs = tf.expand_dims(locs, axis=1) noise_samples = self._compute_noise_samples(scale, num_samples, seed) latents = locs + noise_samples - latents = tf.keras.layers.Reshape( + latents = tf.keras.layers.Reshape( # pyrefly: ignore[not-callable] [num_samples, self._ensemble_size, self._num_classes])(latents) if self._num_classes == 2: return tf.math.sigmoid(latents / self._temperature) @@ -973,7 +973,7 @@ def _compute_loc_param(self, inputs): Returns: Tensor of shape [batch_size, num_classes]. """ - return self._loc_layer(inputs) + return self._loc_layer(inputs) # pyrefly: ignore[not-callable] def _compute_scale_param(self, inputs): """Computes scale parameter of the "logits distribution". @@ -986,10 +986,10 @@ def _compute_scale_param(self, inputs): [batch_size, num_classes]). """ if self._parameter_efficient: - return (inputs, self._diag_layer(inputs) + MIN_SCALE_MONTE_CARLO) + return (inputs, self._diag_layer(inputs) + MIN_SCALE_MONTE_CARLO) # pyrefly: ignore[not-callable] else: - return (self._scale_layer(inputs), - self._diag_layer(inputs) + MIN_SCALE_MONTE_CARLO) + return (self._scale_layer(inputs), # pyrefly: ignore[not-callable] + self._diag_layer(inputs) + MIN_SCALE_MONTE_CARLO) # pyrefly: ignore[not-callable] def _compute_diagonal_noise_samples(self, diag_scale, num_samples, seed): """Compute samples of the diagonal elements logit noise. @@ -1092,9 +1092,9 @@ def _compute_noise_samples(self, scale, num_samples, seed): factor_loadings, num_samples, seed) if self._parameter_efficient: - res = self._scale_layer_homoscedastic(standard_normal_samples) + res = self._scale_layer_homoscedastic(standard_normal_samples) # pyrefly: ignore[not-callable] res *= tf.expand_dims( - self._scale_layer_heteroscedastic(factor_loadings), 1) + self._scale_layer_heteroscedastic(factor_loadings), 1) # pyrefly: ignore[not-callable] else: # reshape scale vector into factor loadings matrix factor_loadings = tf.reshape( @@ -1532,7 +1532,7 @@ def _compute_loc_param(self, inputs): Returns: Tensor of shape [batch_size, num_outputs]. """ - return self._loc_layer(inputs) + return self._loc_layer(inputs) # pyrefly: ignore[not-callable] def _compute_scale_param(self, inputs): """Computes scale parameter of the "logits distribution". @@ -1546,12 +1546,12 @@ def _compute_scale_param(self, inputs): """ if self._num_factors > 0: if self._parameter_efficient: - return (inputs, self._diag_layer(inputs) + MIN_SCALE_MONTE_CARLO) + return (inputs, self._diag_layer(inputs) + MIN_SCALE_MONTE_CARLO) # pyrefly: ignore[not-callable] else: - return (self._scale_layer(inputs), - self._diag_layer(inputs) + MIN_SCALE_MONTE_CARLO) + return (self._scale_layer(inputs), # pyrefly: ignore[not-callable] + self._diag_layer(inputs) + MIN_SCALE_MONTE_CARLO) # pyrefly: ignore[not-callable] else: - return (None, self._diag_layer(inputs) + MIN_SCALE_MONTE_CARLO) + return (None, self._diag_layer(inputs) + MIN_SCALE_MONTE_CARLO) # pyrefly: ignore[not-callable] def _compute_diagonal_noise_samples(self, diag_scale, num_samples, seed): """Compute samples of the diagonal elements logit noise. @@ -1653,9 +1653,9 @@ def _compute_noise_samples(self, scale, num_samples, seed): factor_loadings, num_samples, seed) if self._parameter_efficient: - noise_samples = self._scale_layer_homoscedastic(standard_normal_samples) + noise_samples = self._scale_layer_homoscedastic(standard_normal_samples) # pyrefly: ignore[not-callable] noise_samples *= tf.expand_dims( - self._scale_layer_heteroscedastic(factor_loadings), 1) + self._scale_layer_heteroscedastic(factor_loadings), 1) # pyrefly: ignore[not-callable] return noise_samples + diag_noise_samples else: # reshape scale vector into factor loadings matrix @@ -1769,9 +1769,9 @@ def __call__(self, inputs, training=True): Tuple of (logits, log_probs, probs). Logits can be used with the tf.nn.sigmoid_cross_entropy_with_logits loss function. """ - with tf.name_scope(self._name): - loc = self._loc_layer(inputs) - scale = self._diag_layer(inputs) + self._min_scale + with tf.name_scope(self._name): # pyrefly: ignore[bad-instantiation] + loc = self._loc_layer(inputs) # pyrefly: ignore[not-callable] + scale = self._diag_layer(inputs) + self._min_scale # pyrefly: ignore[not-callable] loc = tf.cast(loc, tf.float32) scale = tf.cast(scale, tf.float32) @@ -1790,9 +1790,9 @@ def __call__(self, inputs, training=True): logits = loc / scale if self._logits_only: - return logits + return logits # pyrefly: ignore[unbound-name] - return logits, log_probs, probs + return logits, log_probs, probs # pyrefly: ignore[unbound-name] def get_config(self): config = { @@ -1875,7 +1875,7 @@ def __call__(self, inputs, training=True): tf.nn.sigmoid_cross_entropy_with_logits or tf.nn.softmax_cross_entropy_with_logits loss functions. """ - with tf.name_scope(self._name): + with tf.name_scope(self._name): # pyrefly: ignore[bad-instantiation] if self._averaging == 'ensemble_cross_ent': log_weights = tf.math.log(self._ensemble_weighting) @@ -2066,7 +2066,7 @@ def _compute_diagonal_noise_samples(self, diag_scale: tf.Tensor, height, width = tf.shape(diag_scale)[1:3] diag_noise_samples = self._genrate_4d_standard_normal_samples( - (num_noise_samples, height, width, self._num_classes), num_samples, + (num_noise_samples, height, width, self._num_classes), num_samples, # pyrefly: ignore[bad-argument-type] seed, diag_scale.dtype) return diag_noise_samples * tf.expand_dims(diag_scale, 1) @@ -2095,7 +2095,7 @@ def _compute_standard_normal_samples(self, factor_loadings: tf.Tensor, height, width = tf.shape(factor_loadings)[1:3] standard_normal_samples = self._genrate_4d_standard_normal_samples( - (num_noise_samples, height, width, self._num_factors), num_samples, + (num_noise_samples, height, width, self._num_factors), num_samples, # pyrefly: ignore[bad-argument-type] seed, factor_loadings.dtype) if self._share_samples_across_batch: @@ -2131,9 +2131,9 @@ def _compute_noise_samples(self, scale: Collection[tf.Tensor], factor_loadings, num_samples, seed) if self._parameter_efficient: - res = self._scale_layer_homoscedastic(standard_normal_samples) + res = self._scale_layer_homoscedastic(standard_normal_samples) # pyrefly: ignore[not-callable] res *= tf.expand_dims( - self._scale_layer_heteroscedastic(factor_loadings), 1) + self._scale_layer_heteroscedastic(factor_loadings), 1) # pyrefly: ignore[not-callable] else: # reshape scale vector into factor loadings matrix batch_size, height, width = tf.shape(factor_loadings)[:3] diff --git a/edward2/tensorflow/layers/heteroscedastic_test.py b/edward2/tensorflow/layers/heteroscedastic_test.py index a23478a6..3ec0af13 100644 --- a/edward2/tensorflow/layers/heteroscedastic_test.py +++ b/edward2/tensorflow/layers/heteroscedastic_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/hetsngp.py b/edward2/tensorflow/layers/hetsngp.py index b66ec7ab..c7aff0e2 100644 --- a/edward2/tensorflow/layers/hetsngp.py +++ b/edward2/tensorflow/layers/hetsngp.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -209,7 +209,7 @@ def __call__(self, inputs, training=True, seed=None): if seed is not None: raise ValueError('Seed should not be provided when running in graph ' 'mode, but %s was provided.' % seed) - with tf.name_scope(self._name): + with tf.name_scope(self._name): # pyrefly: ignore[bad-instantiation] locs, covmat_sngp = self._compute_loc_param(inputs, training) # pylint: disable=assignment-from-none scale = self._compute_scale_param(inputs, covmat_sngp, training) # pylint: disable=assignment-from-none diff --git a/edward2/tensorflow/layers/hetsngp_test.py b/edward2/tensorflow/layers/hetsngp_test.py index 4c133626..c58050f8 100644 --- a/edward2/tensorflow/layers/hetsngp_test.py +++ b/edward2/tensorflow/layers/hetsngp_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/made.py b/edward2/tensorflow/layers/made.py index dac4e1e9..0f11d782 100644 --- a/edward2/tensorflow/layers/made.py +++ b/edward2/tensorflow/layers/made.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -219,7 +219,7 @@ def create_masks(input_dim, def make_masked_initializer(mask): initializer = tf.keras.initializers.GlorotUniform() def masked_initializer(shape, dtype=None): - return mask * initializer(shape, dtype) + return mask * initializer(shape, dtype) # pyrefly: ignore[not-callable] return masked_initializer diff --git a/edward2/tensorflow/layers/made_test.py b/edward2/tensorflow/layers/made_test.py index 1de4d3ae..0e5817df 100644 --- a/edward2/tensorflow/layers/made_test.py +++ b/edward2/tensorflow/layers/made_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/neural_process.py b/edward2/tensorflow/layers/neural_process.py index ad469935..e9f7a7d1 100644 --- a/edward2/tensorflow/layers/neural_process.py +++ b/edward2/tensorflow/layers/neural_process.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -36,9 +36,9 @@ def batch_mlp(inputs, hidden_sizes): hidden = tf.reshape(inputs, (-1, filter_size)) for size in hidden_sizes[:-1]: - hidden = tf.keras.layers.Dense(size, activation=tf.nn.relu)(hidden) + hidden = tf.keras.layers.Dense(size, activation=tf.nn.relu)(hidden) # pyrefly: ignore[not-callable] - output = tf.keras.layers.Dense(hidden_sizes[-1], activation=None)(hidden) + output = tf.keras.layers.Dense(hidden_sizes[-1], activation=None)(hidden) # pyrefly: ignore[not-callable] output = tf.reshape(output, (batch_size, -1, hidden_sizes[-1])) return output @@ -264,15 +264,15 @@ def latent_encoder(self, x, y): per_example_embedding = batch_mlp( encoder_input, self._latent_encoder_sizes) dataset_embedding = tf.reduce_mean(per_example_embedding, axis=1) - hidden = tf.keras.layers.Dense( + hidden = tf.keras.layers.Dense( # pyrefly: ignore[not-callable] (self._latent_encoder_sizes[-1] + self._num_latents)//2, activation=tf.nn.relu)(dataset_embedding) - loc = tf.keras.layers.Dense(self._num_latents, activation=None)(hidden) - untransformed_scale = tf.keras.layers.Dense(self._num_latents, + loc = tf.keras.layers.Dense(self._num_latents, activation=None)(hidden) # pyrefly: ignore[not-callable] + untransformed_scale = tf.keras.layers.Dense(self._num_latents, # pyrefly: ignore[not-callable] activation=None)(hidden) # Constraint scale following Garnelo et al. (2018). scale_diag = 0.1 + 0.9 * tf.sigmoid(untransformed_scale) - return generated_random_variables.MultivariateNormalDiag( + return generated_random_variables.MultivariateNormalDiag( # pyrefly: ignore[missing-attribute] loc=loc, scale_diag=scale_diag) def deterministic_encoder(self, context_x, context_y, target_x): @@ -292,7 +292,7 @@ def deterministic_encoder(self, context_x, context_y, target_x): encoder_input = tf.concat([context_x, context_y], axis=-1) per_example_embedding = batch_mlp(encoder_input, self._deterministic_encoder_sizes) - per_target_embedding = self._attention(context_x, + per_target_embedding = self._attention(context_x, # pyrefly: ignore[not-callable] target_x, per_example_embedding) return per_target_embedding @@ -361,10 +361,10 @@ def __call__(self, query, target_y=None): if target_y is not None: kl = tf.expand_dims( - posterior.distribution.kl_divergence(prior.distribution), + posterior.distribution.kl_divergence(prior.distribution), # pyrefly: ignore[unbound-name] -1) self.add_loss(lambda: kl) return predictive_dist - call = __call__ + call = __call__ # pyrefly: ignore[bad-override] diff --git a/edward2/tensorflow/layers/neural_process_test.py b/edward2/tensorflow/layers/neural_process_test.py index 247fd3ed..2dfff87d 100644 --- a/edward2/tensorflow/layers/neural_process_test.py +++ b/edward2/tensorflow/layers/neural_process_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/noise.py b/edward2/tensorflow/layers/noise.py index 5cb7dff9..3acc9d1d 100644 --- a/edward2/tensorflow/layers/noise.py +++ b/edward2/tensorflow/layers/noise.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -226,7 +226,7 @@ def __init__(self, mean=0., stddev=1., **kwargs): def call(self, inputs): if not isinstance(inputs, random_variable.RandomVariable): # Default to a unit normal, i.e., derived from mean squared error loss. - inputs = generated_random_variables.Normal(loc=inputs, scale=1.) + inputs = generated_random_variables.Normal(loc=inputs, scale=1.) # pyrefly: ignore[missing-attribute] batch_size = tf.shape(inputs)[0] // 2 # TODO(trandustin): Depend on github's ed2 for indexing RVs. This is a hack. # _, _ = inputs[:batch_size], inputs[batch_size:] diff --git a/edward2/tensorflow/layers/noise_test.py b/edward2/tensorflow/layers/noise_test.py index db6f7633..611657e1 100644 --- a/edward2/tensorflow/layers/noise_test.py +++ b/edward2/tensorflow/layers/noise_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/normalization.py b/edward2/tensorflow/layers/normalization.py index a4007f81..7370cecc 100644 --- a/edward2/tensorflow/layers/normalization.py +++ b/edward2/tensorflow/layers/normalization.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -207,8 +207,8 @@ def _get_mean_and_variance(self, x): mean_sq = tf.reduce_mean(tf.square(x), axis=[1, 2, 3]) mean_sq = tf.cast(mean_sq, tf.float32) if replica_context is not None: - mean = tf1.tpu.cross_replica_sum(mean, group_assignment) - mean = mean / num_replicas_per_group + mean = tf1.tpu.cross_replica_sum(mean, group_assignment) # pyrefly: ignore[unbound-name] + mean = mean / num_replicas_per_group # pyrefly: ignore[unbound-name] mean_sq = tf1.tpu.cross_replica_sum(mean_sq, group_assignment) mean_sq = mean_sq / num_replicas_per_group variance = mean_sq - tf.square(mean) @@ -219,8 +219,8 @@ def _get_mean_and_variance(self, x): mean_sq = tf.reduce_mean(tf.square(x), axis=[0, 1, 2]) mean_sq = tf.cast(mean_sq, tf.float32) if replica_context is not None: - mean = tf1.tpu.cross_replica_sum(mean, group_assignment) - mean = mean / num_replicas_per_group + mean = tf1.tpu.cross_replica_sum(mean, group_assignment) # pyrefly: ignore[unbound-name] + mean = mean / num_replicas_per_group # pyrefly: ignore[unbound-name] mean_sq = tf1.tpu.cross_replica_sum(mean_sq, group_assignment) mean_sq = mean_sq / num_replicas_per_group variance = mean_sq - tf.square(mean) @@ -267,7 +267,7 @@ def call(self, inputs, training=None): beta = tf.expand_dims(beta, axis=1) beta = tf.expand_dims(beta, axis=1) x = inputs * tf.cast(inv, inputs.dtype) + tf.cast( - beta - mean * inv if self.beta is not None else ( + beta - mean * inv if self.beta is not None else ( # pyrefly: ignore[unbound-name] -mean * inv), inputs.dtype) else: x = tf.nn.batch_normalization( diff --git a/edward2/tensorflow/layers/normalization_test.py b/edward2/tensorflow/layers/normalization_test.py index 266b6e98..00fcbe4a 100644 --- a/edward2/tensorflow/layers/normalization_test.py +++ b/edward2/tensorflow/layers/normalization_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/posterior_network.py b/edward2/tensorflow/layers/posterior_network.py index 352075cb..25a4de6c 100644 --- a/edward2/tensorflow/layers/posterior_network.py +++ b/edward2/tensorflow/layers/posterior_network.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -54,7 +54,7 @@ def __init__(self, def build(self, input_shape): """Builds the layer based on the passed input shape.""" - with tf.name_scope(self.name): + with tf.name_scope(self.name): # pyrefly: ignore[bad-instantiation] # Using the PyTorch default hyperparameters. self.batch_norm = tf.keras.layers.BatchNormalization(epsilon=1e-5, momentum=0.9) @@ -133,7 +133,7 @@ def __init__(self, validate_args=validate_args, inverse_min_event_ndims=1, name=name) - with tf.name_scope(name) as name: + with tf.name_scope(name) as name: # pyrefly: ignore[bad-instantiation] self._name = name if x0 is None: x0 = tf.zeros(dim) diff --git a/edward2/tensorflow/layers/posterior_network_test.py b/edward2/tensorflow/layers/posterior_network_test.py index 861bfb4f..89b9de62 100644 --- a/edward2/tensorflow/layers/posterior_network_test.py +++ b/edward2/tensorflow/layers/posterior_network_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/random_feature.py b/edward2/tensorflow/layers/random_feature.py index c6aabb6a..7482b48f 100644 --- a/edward2/tensorflow/layers/random_feature.py +++ b/edward2/tensorflow/layers/random_feature.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -274,7 +274,7 @@ def call(self, inputs, global_step=None, training=None): # Assembles model output. model_output = [gp_output,] if self.return_gp_cov: - model_output.append(gp_covmat) + model_output.append(gp_covmat) # pyrefly: ignore[unbound-name] if self.return_random_features: model_output.append(gp_feature) diff --git a/edward2/tensorflow/layers/random_feature_test.py b/edward2/tensorflow/layers/random_feature_test.py index acb479ad..8a50f509 100644 --- a/edward2/tensorflow/layers/random_feature_test.py +++ b/edward2/tensorflow/layers/random_feature_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/recurrent.py b/edward2/tensorflow/layers/recurrent.py index 6afc010d..98711ee8 100644 --- a/edward2/tensorflow/layers/recurrent.py +++ b/edward2/tensorflow/layers/recurrent.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -117,7 +117,7 @@ def build( def bias_initializer(_, *args, **kwargs): return tf.keras.backend.concatenate([ self.bias_initializer((self.units,), *args, **kwargs), - tf.keras.initializers.Ones()((self.units,), *args, **kwargs), + tf.keras.initializers.Ones()((self.units,), *args, **kwargs), # pyrefly: ignore[not-callable] self.bias_initializer((self.units * 2,), *args, **kwargs), ]) else: @@ -146,14 +146,14 @@ def call(self, *args, **kwargs): def call_weights(self): """Calls any weights if the initializer is itself a layer.""" if isinstance(self.kernel_initializer, tf.keras.layers.Layer): - self.kernel = self.kernel_initializer(self.kernel.shape, self.dtype) + self.kernel = self.kernel_initializer(self.kernel.shape, self.dtype) # pyrefly: ignore[not-callable] if isinstance(self.recurrent_initializer, tf.keras.layers.Layer): - self.recurrent_kernel = self.recurrent_initializer( + self.recurrent_kernel = self.recurrent_initializer( # pyrefly: ignore[not-callable] self.recurrent_kernel.shape, self.dtype) if isinstance(self.bias_initializer, tf.keras.layers.Layer): if self.bias is None: raise ValueError('self.bias is None.') - self.bias = self.bias_initializer(self.bias.shape, self.dtype) + self.bias = self.bias_initializer(self.bias.shape, self.dtype) # pyrefly: ignore[not-callable] self.called_weights = True def get_initial_state(self, inputs=None, batch_size=None, dtype=None): @@ -594,7 +594,7 @@ def bias_initializer(_, *args, **kwargs): return tf.concat([ self.bias_initializer([self.ensemble_size, self.units], *args, **kwargs), - tf.keras.initializers.Ones()([self.ensemble_size, self.units], + tf.keras.initializers.Ones()([self.ensemble_size, self.units], # pyrefly: ignore[not-callable] *args, **kwargs), self.bias_initializer([self.ensemble_size, self.units * 2], *args, **kwargs), @@ -642,12 +642,12 @@ def _sample_weights(self, inputs=None, batch_size=None, dtype=None): """Samples any rank-1 weight tensor if the initializer is itself a layer.""" if inputs is not None: batch_size = tf.shape(inputs)[0] - examples_per_model = batch_size // self.ensemble_size + examples_per_model = batch_size // self.ensemble_size # pyrefly: ignore[unsupported-operation] # Sample parameters for each input example. def sample(weight_variable, weight_initializer, shape): if isinstance(weight_initializer, tf.keras.layers.Layer): - weights = weight_initializer( + weights = weight_initializer( # pyrefly: ignore[not-callable] shape, self.dtype).distribution.sample(examples_per_model) weights = tf.transpose(weights, [1, 0, 2]) else: @@ -717,7 +717,7 @@ def call(self, inputs, states, training=None): x_c = tf.linalg.matmul(inputs_c * alpha, k_c) * gamma_c x_o = tf.linalg.matmul(inputs_o * alpha, k_o) * gamma_o if self.use_bias: - b_i, b_f, b_c, b_o = tf.split(bias, num_or_size_splits=4, axis=1) + b_i, b_f, b_c, b_o = tf.split(bias, num_or_size_splits=4, axis=1) # pyrefly: ignore[unbound-name] x_i += b_i x_f += b_f x_c += b_c @@ -748,7 +748,7 @@ def call(self, inputs, states, training=None): z += tf.linalg.matmul( h_tm1 * recurrent_alpha, self.recurrent_kernel) * recurrent_gamma if self.use_bias: - z += bias + z += bias # pyrefly: ignore[unbound-name] z = tf.split(z, num_or_size_splits=4, axis=1) c, o = self._compute_carry_and_output_fused(z, c_tm1) diff --git a/edward2/tensorflow/layers/recurrent_test.py b/edward2/tensorflow/layers/recurrent_test.py index f625fc27..e15d198f 100644 --- a/edward2/tensorflow/layers/recurrent_test.py +++ b/edward2/tensorflow/layers/recurrent_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/stochastic_output.py b/edward2/tensorflow/layers/stochastic_output.py index 947ae750..47392183 100644 --- a/edward2/tensorflow/layers/stochastic_output.py +++ b/edward2/tensorflow/layers/stochastic_output.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -81,7 +81,7 @@ def build(self, input_shape=None): self.built = True def call(self, inputs): - net = self.layer(inputs) + net = self.layer(inputs) # pyrefly: ignore[not-callable] logits, loc, scale = tf.split(net, 3, axis=-1) if self.logits_constraint: logits = self.logits_constraint(logits) @@ -89,10 +89,10 @@ def call(self, inputs): loc = self.loc_constraint(loc) if self.scale_constraint: scale = self.scale_constraint(scale) - return generated_random_variables.MixtureSameFamily( - mixture_distribution=generated_random_variables.Categorical( + return generated_random_variables.MixtureSameFamily( # pyrefly: ignore[missing-attribute] + mixture_distribution=generated_random_variables.Categorical( # pyrefly: ignore[missing-attribute] logits=logits).distribution, - components_distribution=generated_random_variables.Logistic( + components_distribution=generated_random_variables.Logistic( # pyrefly: ignore[missing-attribute] loc=loc, scale=scale).distribution) def compute_output_shape(self, input_shape): diff --git a/edward2/tensorflow/layers/stochastic_output_test.py b/edward2/tensorflow/layers/stochastic_output_test.py index ffef51e2..e892075b 100644 --- a/edward2/tensorflow/layers/stochastic_output_test.py +++ b/edward2/tensorflow/layers/stochastic_output_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/layers/utils.py b/edward2/tensorflow/layers/utils.py index adc5fff5..e6c840c4 100644 --- a/edward2/tensorflow/layers/utils.py +++ b/edward2/tensorflow/layers/utils.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -56,13 +56,13 @@ def _add_weight(self, if not regularizer.built: regularizer.build(shape) if isinstance(initializer, tf.keras.layers.Layer): - with tf.name_scope(name): - weight = initializer(shape, dtype) + with tf.name_scope(name): # pyrefly: ignore[bad-instantiation] + weight = initializer(shape, dtype) # pyrefly: ignore[not-callable] if regularizer is not None: def loss_fn(): """Creates a regularization loss `Tensor`.""" - with tf.name_scope(name + '/Regularizer'): - return regularizer(initializer(shape, dtype)) + with tf.name_scope(name + '/Regularizer'): # pyrefly: ignore[bad-instantiation, unsupported-operation] + return regularizer(initializer(shape, dtype)) # pyrefly: ignore[not-callable] self.add_loss(loss_fn) return weight return super(cls, self).add_weight(name=name, @@ -195,11 +195,11 @@ def py_multiplicative_inverse(a, n): remainder = n new_remainder = a while new_remainder != 0: - quotient = remainder // new_remainder + quotient = remainder // new_remainder # pyrefly: ignore[unsupported-operation] (inverse, new_inverse) = (new_inverse, inverse - quotient * new_inverse) (remainder, new_remainder) = (new_remainder, remainder - quotient * new_remainder) - if remainder > 1: + if remainder > 1: # pyrefly: ignore[unsupported-operation] return ValueError( 'Inverse for {} modulo {} does not exist.'.format(a, n)) if inverse < 0: diff --git a/edward2/tensorflow/layers/utils_test.py b/edward2/tensorflow/layers/utils_test.py index a3e93c98..ae60c58c 100644 --- a/edward2/tensorflow/layers/utils_test.py +++ b/edward2/tensorflow/layers/utils_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/losses.py b/edward2/tensorflow/losses.py index 6c1655d9..e8f30598 100644 --- a/edward2/tensorflow/losses.py +++ b/edward2/tensorflow/losses.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/losses_test.py b/edward2/tensorflow/losses_test.py index 6f2c63b0..d6e3c1f4 100644 --- a/edward2/tensorflow/losses_test.py +++ b/edward2/tensorflow/losses_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/program_transformations.py b/edward2/tensorflow/program_transformations.py index 1cb21dcb..49a0599f 100644 --- a/edward2/tensorflow/program_transformations.py +++ b/edward2/tensorflow/program_transformations.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/program_transformations_test.py b/edward2/tensorflow/program_transformations_test.py index 1c70a7c3..9deb84ec 100644 --- a/edward2/tensorflow/program_transformations_test.py +++ b/edward2/tensorflow/program_transformations_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/random_variable.py b/edward2/tensorflow/random_variable.py index 974fab07..b96028c6 100644 --- a/edward2/tensorflow/random_variable.py +++ b/edward2/tensorflow/random_variable.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -111,7 +111,7 @@ def __init__(self, self._distribution = distribution self._sample_shape = sample_shape if tf.is_tensor(value): - value_shape = value.shape + value_shape = value.shape # pyrefly: ignore[missing-attribute] expected_value_shape = self.sample_shape.concatenate( self.distribution.batch_shape).concatenate( self.distribution.event_shape) @@ -148,7 +148,7 @@ def sample_shape_tensor(self, name="sample_shape_tensor"): Returns: sample_shape: `Tensor`. """ - with tf.name_scope(name): + with tf.name_scope(name): # pyrefly: ignore[bad-instantiation] if tf.is_tensor(self._sample_shape): return self._sample_shape return tf.convert_to_tensor(self.sample_shape.as_list(), dtype=tf.int32) diff --git a/edward2/tensorflow/random_variable_test.py b/edward2/tensorflow/random_variable_test.py index 08cec92b..f3f659ca 100644 --- a/edward2/tensorflow/random_variable_test.py +++ b/edward2/tensorflow/random_variable_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/regularizers.py b/edward2/tensorflow/regularizers.py index 9ed5cbab..3dbe80a9 100644 --- a/edward2/tensorflow/regularizers.py +++ b/edward2/tensorflow/regularizers.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,8 +50,8 @@ def __init__(self, loc=0., scale=1., scale_factor=1.): def __call__(self, x): """Computes regularization using an unbiased Monte Carlo estimate.""" - prior = generated_random_variables.Independent( - generated_random_variables.Cauchy( + prior = generated_random_variables.Independent( # pyrefly: ignore[missing-attribute] + generated_random_variables.Cauchy( # pyrefly: ignore[missing-attribute] loc=tf.broadcast_to(self.loc, x.distribution.event_shape), scale=tf.broadcast_to(self.scale, x.distribution.event_shape) ).distribution, @@ -79,8 +79,8 @@ def __init__(self, loc=0., scale=1., scale_factor=1.): def __call__(self, x): """Computes regularization using an unbiased Monte Carlo estimate.""" - prior = generated_random_variables.Independent( - generated_random_variables.HalfCauchy( + prior = generated_random_variables.Independent( # pyrefly: ignore[missing-attribute] + generated_random_variables.HalfCauchy( # pyrefly: ignore[missing-attribute] loc=tf.broadcast_to(self.loc, x.distribution.event_shape), scale=tf.broadcast_to(self.scale, x.distribution.event_shape) ).distribution, @@ -146,8 +146,8 @@ def __call__(self, x): """Computes regularization given an input ed.RandomVariable.""" if not isinstance(x, random_variable.RandomVariable): raise ValueError('Input must be an ed.RandomVariable.') - prior = generated_random_variables.Independent( - generated_random_variables.LogNormal( + prior = generated_random_variables.Independent( # pyrefly: ignore[missing-attribute] + generated_random_variables.LogNormal( # pyrefly: ignore[missing-attribute] loc=tf.broadcast_to(self.loc, x.distribution.event_shape), scale=tf.broadcast_to(self.scale, x.distribution.event_shape) ).distribution, @@ -176,8 +176,8 @@ def __call__(self, x): """Computes regularization given an input ed.RandomVariable.""" if not isinstance(x, random_variable.RandomVariable): raise ValueError('Input must be an ed.RandomVariable.') - prior = generated_random_variables.Independent( - generated_random_variables.Normal( + prior = generated_random_variables.Independent( # pyrefly: ignore[missing-attribute] + generated_random_variables.Normal( # pyrefly: ignore[missing-attribute] loc=tf.broadcast_to(self.mean, x.distribution.event_shape), scale=tf.broadcast_to(self.stddev, x.distribution.event_shape) ).distribution, @@ -248,7 +248,7 @@ def __call__(self, x): variance /= num_weights + 2. * self.variance_concentration + 2. self.stddev = tf.sqrt(variance) - variance_prior = generated_random_variables.InverseGamma( + variance_prior = generated_random_variables.InverseGamma( # pyrefly: ignore[missing-attribute] self.variance_concentration, self.variance_scale) regularization = super(NormalEmpiricalBayesKLDivergence, self).__call__(x) regularization -= (self.scale_factor * @@ -276,8 +276,8 @@ def __call__(self, x): """Computes regularization given an ed.Normal random variable as input.""" if not isinstance(x, random_variable.RandomVariable): raise ValueError('Input must be an ed.RandomVariable.') - prior = generated_random_variables.Independent( - generated_random_variables.Normal(loc=x.distribution.mean(), + prior = generated_random_variables.Independent( # pyrefly: ignore[missing-attribute] + generated_random_variables.Normal(loc=x.distribution.mean(), # pyrefly: ignore[missing-attribute] scale=self.stddev).distribution, reinterpreted_batch_ndims=len(x.distribution.event_shape)) regularization = x.distribution.kl_divergence(prior.distribution) @@ -327,8 +327,8 @@ def call(self, inputs): stddev = self.stddev if self.stddev_constraint: stddev = self.stddev_constraint(stddev) - prior = generated_random_variables.Independent( - generated_random_variables.Normal( + prior = generated_random_variables.Independent( # pyrefly: ignore[missing-attribute] + generated_random_variables.Normal( # pyrefly: ignore[missing-attribute] loc=self.mean, scale=stddev).distribution, reinterpreted_batch_ndims=len(inputs.distribution.event_shape)) regularization = inputs.distribution.kl_divergence(prior.distribution) diff --git a/edward2/tensorflow/regularizers_test.py b/edward2/tensorflow/regularizers_test.py index a25837b8..29db00c0 100644 --- a/edward2/tensorflow/regularizers_test.py +++ b/edward2/tensorflow/regularizers_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/transformed_random_variable.py b/edward2/tensorflow/transformed_random_variable.py index dbb4888c..0a009d71 100644 --- a/edward2/tensorflow/transformed_random_variable.py +++ b/edward2/tensorflow/transformed_random_variable.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tensorflow/transformed_random_variable_test.py b/edward2/tensorflow/transformed_random_variable_test.py index 68618724..df45552a 100644 --- a/edward2/tensorflow/transformed_random_variable_test.py +++ b/edward2/tensorflow/transformed_random_variable_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/trace.py b/edward2/trace.py index 3ef404a2..3f90d93a 100644 --- a/edward2/trace.py +++ b/edward2/trace.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/trace_test.py b/edward2/trace_test.py index 5c0af616..901ff0bf 100644 --- a/edward2/trace_test.py +++ b/edward2/trace_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tracers.py b/edward2/tracers.py index 30e65fbc..63da0775 100644 --- a/edward2/tracers.py +++ b/edward2/tracers.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/tracers_test.py b/edward2/tracers_test.py index dec656c3..d6edeb6f 100644 --- a/edward2/tracers_test.py +++ b/edward2/tracers_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/edward2/version.py b/edward2/version.py index 04feac6f..1beace5b 100644 --- a/edward2/version.py +++ b/edward2/version.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/examples/no_u_turn_sampler/__init__.py b/examples/no_u_turn_sampler/__init__.py index 1c6efc4a..5a6f6c07 100644 --- a/examples/no_u_turn_sampler/__init__.py +++ b/examples/no_u_turn_sampler/__init__.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/examples/no_u_turn_sampler/logistic_regression.py b/examples/no_u_turn_sampler/logistic_regression.py index 3b4c8b7c..0bf2aedb 100644 --- a/examples/no_u_turn_sampler/logistic_regression.py +++ b/examples/no_u_turn_sampler/logistic_regression.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -65,9 +65,9 @@ def func_wrapped(*args, **kwargs): def logistic_regression(features): """Bayesian logistic regression, which returns labels given features.""" - coeffs = ed.MultivariateNormalDiag( + coeffs = ed.MultivariateNormalDiag( # pyrefly: ignore[missing-attribute] loc=tf.zeros(features.shape[1]), name="coeffs") - labels = ed.Bernoulli( + labels = ed.Bernoulli( # pyrefly: ignore[missing-attribute] logits=tf.tensordot(features, coeffs, [[1], [0]]), name="labels") return labels diff --git a/examples/no_u_turn_sampler/nuts.py b/examples/no_u_turn_sampler/nuts.py index 4259b4f3..f0bd45f1 100644 --- a/examples/no_u_turn_sampler/nuts.py +++ b/examples/no_u_turn_sampler/nuts.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -73,8 +73,8 @@ def kernel(target_log_prob_fn, if not tf.executing_eagerly(): raise NotImplementedError("`kernel` is only available in Eager mode.") - with tf.name_scope(name): - with tf.name_scope("initialize"): + with tf.name_scope(name): # pyrefly: ignore[bad-instantiation] + with tf.name_scope("initialize"): # pyrefly: ignore[bad-instantiation] current_state = [tf.convert_to_tensor(s) for s in current_state] step_size = [tf.convert_to_tensor(s) for s in step_size] if (current_target_log_prob is None or @@ -487,7 +487,7 @@ def _random_bernoulli(shape, seed=None, name="random_bernoulli"): """Returns samples from a Bernoulli distribution.""" - with tf.name_scope(name): + with tf.name_scope(name): # pyrefly: ignore[bad-instantiation] probs = tf.convert_to_tensor(probs) random_uniform = tf.random.uniform(shape, dtype=probs.dtype, seed=seed) return tf.cast(tf.less(random_uniform, probs), dtype) diff --git a/examples/no_u_turn_sampler/nuts_test.py b/examples/no_u_turn_sampler/nuts_test.py index 3fa5605f..f765a548 100644 --- a/examples/no_u_turn_sampler/nuts_test.py +++ b/examples/no_u_turn_sampler/nuts_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/examples/notebooks/embedded_reber_grammar.py b/examples/notebooks/embedded_reber_grammar.py index 5324ac56..ebb6191b 100644 --- a/examples/notebooks/embedded_reber_grammar.py +++ b/examples/notebooks/embedded_reber_grammar.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/attention.py b/experimental/attentive_uncertainty/attention.py index 54fde5c6..36b6d4ad 100644 --- a/experimental/attentive_uncertainty/attention.py +++ b/experimental/attentive_uncertainty/attention.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/contextual_bandits/benchmark.py b/experimental/attentive_uncertainty/contextual_bandits/benchmark.py index f4e0f2d2..ff0cb2b8 100644 --- a/experimental/attentive_uncertainty/contextual_bandits/benchmark.py +++ b/experimental/attentive_uncertainty/contextual_bandits/benchmark.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/contextual_bandits/benchmark_gnp.py b/experimental/attentive_uncertainty/contextual_bandits/benchmark_gnp.py index 1acf61b0..0cb22fae 100644 --- a/experimental/attentive_uncertainty/contextual_bandits/benchmark_gnp.py +++ b/experimental/attentive_uncertainty/contextual_bandits/benchmark_gnp.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/contextual_bandits/datasets.py b/experimental/attentive_uncertainty/contextual_bandits/datasets.py index a526e54e..0121e1fa 100644 --- a/experimental/attentive_uncertainty/contextual_bandits/datasets.py +++ b/experimental/attentive_uncertainty/contextual_bandits/datasets.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/contextual_bandits/offline_contextual_bandits.py b/experimental/attentive_uncertainty/contextual_bandits/offline_contextual_bandits.py index 3a7bd935..1578a2e6 100644 --- a/experimental/attentive_uncertainty/contextual_bandits/offline_contextual_bandits.py +++ b/experimental/attentive_uncertainty/contextual_bandits/offline_contextual_bandits.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/contextual_bandits/offline_contextual_bandits_gnp.py b/experimental/attentive_uncertainty/contextual_bandits/offline_contextual_bandits_gnp.py index 28b04c6d..7df1a2fc 100644 --- a/experimental/attentive_uncertainty/contextual_bandits/offline_contextual_bandits_gnp.py +++ b/experimental/attentive_uncertainty/contextual_bandits/offline_contextual_bandits_gnp.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/contextual_bandits/online_contextual_bandits.py b/experimental/attentive_uncertainty/contextual_bandits/online_contextual_bandits.py index b696c91f..8a01c1f2 100644 --- a/experimental/attentive_uncertainty/contextual_bandits/online_contextual_bandits.py +++ b/experimental/attentive_uncertainty/contextual_bandits/online_contextual_bandits.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/contextual_bandits/pretrain.py b/experimental/attentive_uncertainty/contextual_bandits/pretrain.py index ae451cd7..3bb618d7 100644 --- a/experimental/attentive_uncertainty/contextual_bandits/pretrain.py +++ b/experimental/attentive_uncertainty/contextual_bandits/pretrain.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/contextual_bandits/pretrain_gnp.py b/experimental/attentive_uncertainty/contextual_bandits/pretrain_gnp.py index 9dc9e7d5..bdde2b5a 100644 --- a/experimental/attentive_uncertainty/contextual_bandits/pretrain_gnp.py +++ b/experimental/attentive_uncertainty/contextual_bandits/pretrain_gnp.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/contextual_bandits/run_offline_contextual_bandits.py b/experimental/attentive_uncertainty/contextual_bandits/run_offline_contextual_bandits.py index adfed08f..97d92a6a 100644 --- a/experimental/attentive_uncertainty/contextual_bandits/run_offline_contextual_bandits.py +++ b/experimental/attentive_uncertainty/contextual_bandits/run_offline_contextual_bandits.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/contextual_bandits/run_offline_contextual_bandits_gnp.py b/experimental/attentive_uncertainty/contextual_bandits/run_offline_contextual_bandits_gnp.py index 2efeabd1..f751f4c6 100644 --- a/experimental/attentive_uncertainty/contextual_bandits/run_offline_contextual_bandits_gnp.py +++ b/experimental/attentive_uncertainty/contextual_bandits/run_offline_contextual_bandits_gnp.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/contextual_bandits/utils.py b/experimental/attentive_uncertainty/contextual_bandits/utils.py index 0282d7a8..69164c9c 100644 --- a/experimental/attentive_uncertainty/contextual_bandits/utils.py +++ b/experimental/attentive_uncertainty/contextual_bandits/utils.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/generalized_neural_process.py b/experimental/attentive_uncertainty/generalized_neural_process.py index 596d5589..64f1aec5 100644 --- a/experimental/attentive_uncertainty/generalized_neural_process.py +++ b/experimental/attentive_uncertainty/generalized_neural_process.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/layers.py b/experimental/attentive_uncertainty/layers.py index 57e6002c..b4f14f5a 100644 --- a/experimental/attentive_uncertainty/layers.py +++ b/experimental/attentive_uncertainty/layers.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/regressor.py b/experimental/attentive_uncertainty/regressor.py index 1fd824cb..f8df190a 100644 --- a/experimental/attentive_uncertainty/regressor.py +++ b/experimental/attentive_uncertainty/regressor.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/toy_regression/datasets.py b/experimental/attentive_uncertainty/toy_regression/datasets.py index 50d0e0b6..47a1bbef 100644 --- a/experimental/attentive_uncertainty/toy_regression/datasets.py +++ b/experimental/attentive_uncertainty/toy_regression/datasets.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/toy_regression/utils.py b/experimental/attentive_uncertainty/toy_regression/utils.py index f9b297b9..b94a8a57 100644 --- a/experimental/attentive_uncertainty/toy_regression/utils.py +++ b/experimental/attentive_uncertainty/toy_regression/utils.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/attentive_uncertainty/utils.py b/experimental/attentive_uncertainty/utils.py index 0d21a3c9..c0a3e955 100644 --- a/experimental/attentive_uncertainty/utils.py +++ b/experimental/attentive_uncertainty/utils.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/auxiliary_sampling/compute_metrics.py b/experimental/auxiliary_sampling/compute_metrics.py index eb285ef1..733c87fc 100644 --- a/experimental/auxiliary_sampling/compute_metrics.py +++ b/experimental/auxiliary_sampling/compute_metrics.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/auxiliary_sampling/datasets.py b/experimental/auxiliary_sampling/datasets.py index bcb55d08..fed4a17a 100644 --- a/experimental/auxiliary_sampling/datasets.py +++ b/experimental/auxiliary_sampling/datasets.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/auxiliary_sampling/deterministic_baseline/lenet5.py b/experimental/auxiliary_sampling/deterministic_baseline/lenet5.py index 22746a55..eb57e376 100644 --- a/experimental/auxiliary_sampling/deterministic_baseline/lenet5.py +++ b/experimental/auxiliary_sampling/deterministic_baseline/lenet5.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/auxiliary_sampling/deterministic_baseline/run_det_training.py b/experimental/auxiliary_sampling/deterministic_baseline/run_det_training.py index 2d7ba511..ccb12330 100644 --- a/experimental/auxiliary_sampling/deterministic_baseline/run_det_training.py +++ b/experimental/auxiliary_sampling/deterministic_baseline/run_det_training.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/auxiliary_sampling/lenet5.py b/experimental/auxiliary_sampling/lenet5.py index e224354e..276d9e99 100644 --- a/experimental/auxiliary_sampling/lenet5.py +++ b/experimental/auxiliary_sampling/lenet5.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/auxiliary_sampling/res_net.py b/experimental/auxiliary_sampling/res_net.py index 2546a9d2..0039ab16 100644 --- a/experimental/auxiliary_sampling/res_net.py +++ b/experimental/auxiliary_sampling/res_net.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/auxiliary_sampling/run_training.py b/experimental/auxiliary_sampling/run_training.py index 6e98c701..9f152958 100644 --- a/experimental/auxiliary_sampling/run_training.py +++ b/experimental/auxiliary_sampling/run_training.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/auxiliary_sampling/sampling.py b/experimental/auxiliary_sampling/sampling.py index fb554276..a9606a28 100644 --- a/experimental/auxiliary_sampling/sampling.py +++ b/experimental/auxiliary_sampling/sampling.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/auxiliary_sampling/sampling_test.py b/experimental/auxiliary_sampling/sampling_test.py index 97e679c3..173145fb 100644 --- a/experimental/auxiliary_sampling/sampling_test.py +++ b/experimental/auxiliary_sampling/sampling_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/marginalization_mixup/augment.py b/experimental/marginalization_mixup/augment.py index 9832ef91..6cfcd5f3 100644 --- a/experimental/marginalization_mixup/augment.py +++ b/experimental/marginalization_mixup/augment.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/marginalization_mixup/batchensemble.py b/experimental/marginalization_mixup/batchensemble.py index e95cd2cf..8d08c898 100644 --- a/experimental/marginalization_mixup/batchensemble.py +++ b/experimental/marginalization_mixup/batchensemble.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/marginalization_mixup/batchensemble_model.py b/experimental/marginalization_mixup/batchensemble_model.py index eef7c5d6..1075ac6e 100644 --- a/experimental/marginalization_mixup/batchensemble_model.py +++ b/experimental/marginalization_mixup/batchensemble_model.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/marginalization_mixup/batchensemble_tune.py b/experimental/marginalization_mixup/batchensemble_tune.py index 63ace205..77c2df15 100644 --- a/experimental/marginalization_mixup/batchensemble_tune.py +++ b/experimental/marginalization_mixup/batchensemble_tune.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/marginalization_mixup/data_utils.py b/experimental/marginalization_mixup/data_utils.py index 794fb1ee..cc3d94b9 100644 --- a/experimental/marginalization_mixup/data_utils.py +++ b/experimental/marginalization_mixup/data_utils.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/marginalization_mixup/deterministic.py b/experimental/marginalization_mixup/deterministic.py index 034f0f57..c76c7fed 100644 --- a/experimental/marginalization_mixup/deterministic.py +++ b/experimental/marginalization_mixup/deterministic.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/marginalization_mixup/dropout.py b/experimental/marginalization_mixup/dropout.py index a3f40d2d..d6e30f03 100644 --- a/experimental/marginalization_mixup/dropout.py +++ b/experimental/marginalization_mixup/dropout.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/marginalization_mixup/ensemble_layers.py b/experimental/marginalization_mixup/ensemble_layers.py index 27f4404a..bc2d2946 100644 --- a/experimental/marginalization_mixup/ensemble_layers.py +++ b/experimental/marginalization_mixup/ensemble_layers.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/marginalization_mixup/naive_ensembles.py b/experimental/marginalization_mixup/naive_ensembles.py index a0a173f9..3757e36b 100644 --- a/experimental/marginalization_mixup/naive_ensembles.py +++ b/experimental/marginalization_mixup/naive_ensembles.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/marginalization_mixup/sngp.py b/experimental/marginalization_mixup/sngp.py index 08b1f8a6..2d03a421 100644 --- a/experimental/marginalization_mixup/sngp.py +++ b/experimental/marginalization_mixup/sngp.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/marginalization_mixup/temperature_scaling.py b/experimental/marginalization_mixup/temperature_scaling.py index 43983c96..49a5eed1 100644 --- a/experimental/marginalization_mixup/temperature_scaling.py +++ b/experimental/marginalization_mixup/temperature_scaling.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/marginalization_mixup/temperature_scaling_tune.py b/experimental/marginalization_mixup/temperature_scaling_tune.py index 552bcf06..a6c71904 100644 --- a/experimental/marginalization_mixup/temperature_scaling_tune.py +++ b/experimental/marginalization_mixup/temperature_scaling_tune.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/mimo/cifar.py b/experimental/mimo/cifar.py index edc49dfe..59dfd1de 100644 --- a/experimental/mimo/cifar.py +++ b/experimental/mimo/cifar.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/mimo/cifar_model.py b/experimental/mimo/cifar_model.py index d51116ff..fd3eb2e1 100644 --- a/experimental/mimo/cifar_model.py +++ b/experimental/mimo/cifar_model.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/mimo/cifar_model_reg_path.py b/experimental/mimo/cifar_model_reg_path.py index 67446b52..cfefe509 100644 --- a/experimental/mimo/cifar_model_reg_path.py +++ b/experimental/mimo/cifar_model_reg_path.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/mimo/cifar_model_test.py b/experimental/mimo/cifar_model_test.py index 3c6ef1ad..afda1dfe 100644 --- a/experimental/mimo/cifar_model_test.py +++ b/experimental/mimo/cifar_model_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/mimo/cifar_reg_path.py b/experimental/mimo/cifar_reg_path.py index 999cd818..b0c6f554 100644 --- a/experimental/mimo/cifar_reg_path.py +++ b/experimental/mimo/cifar_reg_path.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/mimo/configs/cifar_batch_repetitions_ablation.py b/experimental/mimo/configs/cifar_batch_repetitions_ablation.py index 5bc08398..6bac730b 100644 --- a/experimental/mimo/configs/cifar_batch_repetitions_ablation.py +++ b/experimental/mimo/configs/cifar_batch_repetitions_ablation.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/mimo/configs/imagenet_batch_repetitions_ablation.py b/experimental/mimo/configs/imagenet_batch_repetitions_ablation.py index 3e1ce528..e3823e01 100644 --- a/experimental/mimo/configs/imagenet_batch_repetitions_ablation.py +++ b/experimental/mimo/configs/imagenet_batch_repetitions_ablation.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/mimo/configs/l1_l2_study.py b/experimental/mimo/configs/l1_l2_study.py index dcd77645..ae26f2b3 100644 --- a/experimental/mimo/configs/l1_l2_study.py +++ b/experimental/mimo/configs/l1_l2_study.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/mimo/imagenet.py b/experimental/mimo/imagenet.py index bed70a6d..abfa63ad 100644 --- a/experimental/mimo/imagenet.py +++ b/experimental/mimo/imagenet.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/mimo/imagenet_model.py b/experimental/mimo/imagenet_model.py index 139cd062..ce358bda 100644 --- a/experimental/mimo/imagenet_model.py +++ b/experimental/mimo/imagenet_model.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/mimo/imagenet_model_test.py b/experimental/mimo/imagenet_model_test.py index 7d9d0c39..4a150054 100644 --- a/experimental/mimo/imagenet_model_test.py +++ b/experimental/mimo/imagenet_model_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/rank1_bnns/cifar-refined-vi.py b/experimental/rank1_bnns/cifar-refined-vi.py index 9f8f9e20..7de39995 100644 --- a/experimental/rank1_bnns/cifar-refined-vi.py +++ b/experimental/rank1_bnns/cifar-refined-vi.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/rank1_bnns/cifar.py b/experimental/rank1_bnns/cifar.py index 073c03a2..32c112c6 100644 --- a/experimental/rank1_bnns/cifar.py +++ b/experimental/rank1_bnns/cifar.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/rank1_bnns/cifar_model.py b/experimental/rank1_bnns/cifar_model.py index 2a75d155..d72776c3 100644 --- a/experimental/rank1_bnns/cifar_model.py +++ b/experimental/rank1_bnns/cifar_model.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/rank1_bnns/imagenet.py b/experimental/rank1_bnns/imagenet.py index 4f0baff2..d502547e 100644 --- a/experimental/rank1_bnns/imagenet.py +++ b/experimental/rank1_bnns/imagenet.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/rank1_bnns/imagenet_model.py b/experimental/rank1_bnns/imagenet_model.py index 8556fda6..819c03e6 100644 --- a/experimental/rank1_bnns/imagenet_model.py +++ b/experimental/rank1_bnns/imagenet_model.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/rank1_bnns/refining.py b/experimental/rank1_bnns/refining.py index d2d6d0b9..17e724d5 100644 --- a/experimental/rank1_bnns/refining.py +++ b/experimental/rank1_bnns/refining.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/rank1_bnns/resnet_cifar_main.py b/experimental/rank1_bnns/resnet_cifar_main.py index abf9d401..e6ffdada 100644 --- a/experimental/rank1_bnns/resnet_cifar_main.py +++ b/experimental/rank1_bnns/resnet_cifar_main.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/rank1_bnns/resnet_cifar_model.py b/experimental/rank1_bnns/resnet_cifar_model.py index 25230802..101eee95 100644 --- a/experimental/rank1_bnns/resnet_cifar_model.py +++ b/experimental/rank1_bnns/resnet_cifar_model.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/rank1_bnns/resnet_cifar_model_test.py b/experimental/rank1_bnns/resnet_cifar_model_test.py index 1bce2272..c3759a75 100644 --- a/experimental/rank1_bnns/resnet_cifar_model_test.py +++ b/experimental/rank1_bnns/resnet_cifar_model_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/rank1_bnns/utils.py b/experimental/rank1_bnns/utils.py index 81348dbf..1c06d9e3 100644 --- a/experimental/rank1_bnns/utils.py +++ b/experimental/rank1_bnns/utils.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/sngp/__init__.py b/experimental/sngp/__init__.py index a070bf8b..9bdc6697 100644 --- a/experimental/sngp/__init__.py +++ b/experimental/sngp/__init__.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/sngp/gaussian_process.py b/experimental/sngp/gaussian_process.py index 0235a611..ddce77e7 100644 --- a/experimental/sngp/gaussian_process.py +++ b/experimental/sngp/gaussian_process.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/sngp/gaussian_process_test.py b/experimental/sngp/gaussian_process_test.py index f277fb19..f99e7b4d 100644 --- a/experimental/sngp/gaussian_process_test.py +++ b/experimental/sngp/gaussian_process_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/sngp/normalization.py b/experimental/sngp/normalization.py index d3ed672b..e049f144 100644 --- a/experimental/sngp/normalization.py +++ b/experimental/sngp/normalization.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/sngp/normalization_test.py b/experimental/sngp/normalization_test.py index c9629541..0964ec71 100644 --- a/experimental/sngp/normalization_test.py +++ b/experimental/sngp/normalization_test.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/experimental/sngp/utils.py b/experimental/sngp/utils.py index 40ea83aa..b516099d 100644 --- a/experimental/sngp/utils.py +++ b/experimental/sngp/utils.py @@ -1,5 +1,5 @@ # coding=utf-8 -# Copyright 2025 The Edward2 Authors. +# Copyright 2026 The Edward2 Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.