DynamicGraph
public final class DynamicGraph
A dynamic graph is a workspace for computations. All tensor variables can be tracked from a dynamic graph.
-
A type-erased tensor variable.
See moreDeclaration
Swift
public class AnyTensor
extension DynamicGraph.AnyTensor: CustomStringConvertible
extension DynamicGraph.AnyTensor: DynamicGraph_AnyTensor
extension DynamicGraph.AnyTensor: DynamicGraph.AnyTensorGroup
extension DynamicGraph.AnyTensor: DynamicGraph_Any
-
A typed tensor variable.
See moreDeclaration
Swift
public final class Tensor<Element> : AnyTensor where Element : TensorNumeric
extension DynamicGraph.Tensor: _DynamicGraph_TensorGroup
extension DynamicGraph.Tensor: DynamicGraph.TensorGroup
-
Undocumented
Declaration
Swift
public init()
-
Type-aware group of tensors.
See moreDeclaration
Swift
public struct Group<Element: DynamicGraph.AnyTensor>: RandomAccessCollection, DynamicGraph .AnyGroup
extension DynamicGraph.Group: DynamicGraph_AnyTensor where Element: DynamicGraph.AnyTensor
extension DynamicGraph.Group: DynamicGraph.AnyTensorGroup where Element: DynamicGraph.AnyTensor
extension DynamicGraph.Group: DynamicGraph.TensorGroup where Element: _DynamicGraph_TensorGroup, Element: DynamicGraph.AnyTensor
-
Undocumented
See moreDeclaration
Swift
public enum LogLevel
-
Set the log level on a dynamic graph.
Declaration
Swift
public var logLevel: LogLevel { get set }
-
Statistics about the graph.
See moreDeclaration
Swift
public struct Statistics
-
Collect statistics from a dynamic graph. It computes how many variables and computations are still tracked. If you have memory leaks, this is useful to track down that.
Declaration
Swift
public var statistics: Statistics { get }
-
Create a placeholder variable. It doesn’t have shape and can only be used as output.
Declaration
Swift
public func variable() -> AnyTensor
-
Create a placeholder constant. It doesn’t have shape and can only be used as output.
Declaration
Swift
public func constant() -> AnyTensor
-
Create a new variable from an existing tensor.
Declaration
Swift
public func variable<Element>(_ tensor: NNC.Tensor<Element>) -> Tensor<Element> where Element : TensorNumeric
Parameters
tensor
The existing tensor.
Return Value
Created new tensor variable.
-
Create a new constant from an existing tensor.
Declaration
Swift
public func constant<Element>(_ tensor: NNC.Tensor<Element>) -> Tensor<Element> where Element : TensorNumeric
Parameters
tensor
The existing tensor.
Return Value
Created new tensor constant.
-
Undocumented
Declaration
Swift
public func variable<Element: TensorNumeric>( _ device: DeviceKind, format: TensorFormat, dimensions: [Int] ) -> Tensor<Element>
-
Undocumented
Declaration
Swift
public func constant<Element: TensorNumeric>( _ device: DeviceKind, format: TensorFormat, dimensions: [Int] ) -> Tensor<Element>
-
Undocumented
Declaration
Swift
public func variable<Element: TensorNumeric>( _ device: DeviceKind, _ dimensionFormat: TensorDimensionFormat ) -> Tensor<Element>
-
Undocumented
Declaration
Swift
public func constant<Element: TensorNumeric>( _ device: DeviceKind, _ dimensionFormat: TensorDimensionFormat ) -> Tensor<Element>
-
Turn off gradient tracking within the given closure. This may be useful during testing, we can make more aggressive optimizations if the gradient tracking is off.
Declaration
Swift
public func withNoGrad<Result>(_ closure: () throws -> Result) rethrows -> Result
-
Perform operations on a given stream within the closure. Each operation can take a stream context parameter, however, that often error-prune. This method make sure all operations within the closure will be dispatched to the given stream context, making it easier to organize.
Declaration
Swift
public func withStream<Result>(_ streamContext: StreamContext, _ closure: () throws -> Result) rethrows -> Result
-
Undocumented
Declaration
Swift
public typealias AnyTensorGroup = DynamicGraph_AnyTensorGroup
-
Undocumented
Declaration
Swift
public typealias TensorGroup = DynamicGraph_TensorGroup
-
Undocumented
Declaration
Swift
public typealias AnyGroup = DynamicGraph_AnyGroup
-
A key-value based parameter store.
See moreDeclaration
Swift
public struct Store
-
Open the store from a file.
Declaration
Swift
@discardableResult public func openStore(_ filePath: String, procedure: (_ store: Store) -> Void) -> Bool
Parameters
filePath
The file path for the store.
procedure
When the store is open, you can access it from this closure.
Return Value
Wether this store can be successfully open or not.