Skip to content

Commit

Permalink
Up version
Browse files Browse the repository at this point in the history
  • Loading branch information
altavir committed Feb 13, 2022
1 parent 745a7ad commit 4084439
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ allprojects {
}

group = "space.kscience"
version = "0.3.0-dev-17"
version = "0.3.0-dev-18"
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ public open class FunctionalExpressionExtendedField<T, out A : ExtendedField<T>>

override fun binaryOperationFunction(operation: String): (left: Expression<T>, right: Expression<T>) -> Expression<T> =
super<FunctionalExpressionField>.binaryOperationFunction(operation)

override fun bindSymbol(value: String): Expression<T> = super<FunctionalExpressionField>.bindSymbol(value)
}

public inline fun <T, A : Group<T>> A.expressionInGroup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.sqrt(x: Aut
public fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.pow(
x: AutoDiffValue<T>,
y: Double,
): AutoDiffValue<T> = derive(const { x.value.pow(y)}) { z ->
): AutoDiffValue<T> = derive(const { x.value.pow(y) }) { z ->
x.d += z.d * y * x.value.pow(y - 1)
}

Expand Down Expand Up @@ -343,10 +343,7 @@ public fun <T : Any, F : ExtendedField<T>> SimpleAutoDiffField<T, F>.atanh(x: Au
public class SimpleAutoDiffExtendedField<T : Any, F : ExtendedField<T>>(
context: F,
bindings: Map<Symbol, T>,
) : ExtendedField<AutoDiffValue<T>>, ScaleOperations<AutoDiffValue<T>>,
SimpleAutoDiffField<T, F>(context, bindings) {

override fun bindSymbol(value: String): AutoDiffValue<T> = super<SimpleAutoDiffField>.bindSymbol(value)
) : ExtendedField<AutoDiffValue<T>>, ScaleOperations<AutoDiffValue<T>>, SimpleAutoDiffField<T, F>(context, bindings) {

override fun number(value: Number): AutoDiffValue<T> = const { number(value) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,16 @@ public abstract class TensorFlowAlgebra<T, TT : TNumber, A : Ring<T>> internal c
ops.math.argMax(asTensorFlow().output, ops.constant(dim), TInt32::class.java).output()
).actualTensor

// private val symbolCache = HashMap<String, TensorFlowOutput<T, TT>>()
//
// override fun bindSymbolOrNull(value: String): TensorFlowOutput<T, TT>? {
// return symbolCache.getOrPut(value){ops.var}
// }
//
// public fun StructureND<T>.grad(
//
// )= operate { ops.gradients() }

@OptIn(UnstableKMathAPI::class)
override fun export(arg: StructureND<T>): StructureND<T> =
if (arg is TensorFlowOutput<T, *>) arg.actualTensor else arg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ public fun <T, TT : TNumber, A> TensorFlowAlgebra<T, TT, A>.sin(

public fun <T, TT : TNumber, A> TensorFlowAlgebra<T, TT, A>.cos(
arg: StructureND<T>,
): TensorFlowOutput<T, TT> where A : TrigonometricOperations<T>, A : Ring<T> = arg.operate { ops.math.cos(it) }
): TensorFlowOutput<T, TT> where A : TrigonometricOperations<T>, A : Ring<T> = arg.operate { ops.math.cos(it) }

0 comments on commit 4084439

Please sign in to comment.