Skip to content

Commit

Permalink
change default clip value
Browse files Browse the repository at this point in the history
  • Loading branch information
dn070017 committed Dec 14, 2023
1 parent a2c9519 commit 524d2f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cavachon/utils/TensorUtils.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from typing import Dict, Iterable, List, Optional, Tuple

import numpy as np
import pandas as pd
import scipy
import tensorflow as tf
from sklearn.preprocessing import LabelEncoder

from cavachon.utils.DataFrameUtils import DataFrameUtils
from sklearn.preprocessing import LabelEncoder
from typing import Dict, Iterable, List, Optional, Tuple


class TensorUtils:
"""TensorUtils
Expand Down Expand Up @@ -37,7 +39,7 @@ def max_n_neurons(layers: Iterable[tf.keras.layers.Layer]) -> int:
return current_max

@staticmethod
def remove_nan_gradients(gradients: List[tf.Tensor], clip_value=0.1) -> List[tf.Tensor]:
def remove_nan_gradients(gradients: List[tf.Tensor], clip_value=10) -> List[tf.Tensor]:
"""Replace nan, inf with 0 and perform gradient clipping for the
gradients computed by tf.GradientTape.gradient().
Expand Down

0 comments on commit 524d2f4

Please sign in to comment.