Skip to content

Commit

Permalink
✨ feat: BCE1D, BCE2D, VQ2D & VQSeq as losses (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-francoisreboud authored Jul 7, 2023
1 parent be79503 commit ada5360
Show file tree
Hide file tree
Showing 45 changed files with 6,450 additions and 2,985 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.

## [unreleased]

🪜 **feat:** BCE1D, BCE2D, VQ2D & VQSeq as losses ([#101](https://github.com/owkin/GrAIdient/pull/101))\
🪜 **layer_seq:** VQSeq ([#100](https://github.com/owkin/GrAIdient/pull/100))\
🔨 **layer_2d:** expose indices in VQ2D ([#99](https://github.com/owkin/GrAIdient/pull/99))\
🪜 **layer_2d:** loosen range contraint in ColorJitterHSV ([#98](https://github.com/owkin/GrAIdient/pull/98))\
Expand Down
9 changes: 8 additions & 1 deletion Sources/GrAIdient/Core/Function/Activation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,14 @@ public class Sigmoid: ActivationFunction
///
public override func apply(_ x: Double) -> Double
{
return 1 / (1 + exp(-x))
if x >= 0
{
return 1 / (1 + exp(-x))
}
else
{
return exp(x) / (1 + exp(x))
}
}

///
Expand Down
19 changes: 19 additions & 0 deletions Sources/GrAIdient/Core/Layer/LayerUpdate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@

import Foundation

/// Error occuring in an output layer.
public enum LossError: Error
{
/// Ground truth has an unexected value.
case GroundTruthValue
}

extension LossError: CustomStringConvertible
{
public var description: String
{
switch self
{
case .GroundTruthValue:
return "Ground truth has an unexpected value."
}
}
}

/// Running phase of a model.
public enum Phase
{
Expand Down
Loading

0 comments on commit ada5360

Please sign in to comment.