Group
public struct Group<Element> : RandomAccessCollection where Element : DynamicGraph.AnyTensor
extension DynamicGraph.Group: DynamicGraph.AnyGroup
extension DynamicGraph.Group: DynamicGraph_Any 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
Type-aware group of tensors.
-
Declaration
Swift
public typealias Element = Element
-
Declaration
Swift
public typealias Index = Int
-
Declaration
Swift
public typealias Indices = Range<Index>
-
Declaration
Swift
public typealias SubSequence = Array<Element>.SubSequence
-
Declaration
Swift
public var endIndex: Index { get }
-
Declaration
Swift
public var indices: Indices { get }
-
Declaration
Swift
public var startIndex: Index { get }
-
Declaration
Swift
public func formIndex(after i: inout Index)
-
Declaration
Swift
public func formIndex(before i: inout Index)
-
Declaration
Swift
public subscript(x: Indices) -> SubSequence { get }
-
Declaration
Swift
public init(_ elements: Element...)
-
Declaration
Swift
public init<OtherElement>(_ otherGroup: Group<OtherElement>) where OtherElement : DynamicGraph.AnyTensor
-
Declaration
Swift
public init(_ underlyingArray: [Element])
-
Compute gradients from this tensor to the source tensors.
Declaration
Swift
public func backward<S: Sequence>(to tensors: S, streamContext: StreamContext? = nil) where S.Element: DynamicGraph.AnyGroup
Parameters
to
The source tensors to this tensor.
streamContext
The stream context to perform such operation.
-
Compute gradients from this tensor to the source tensor.
Declaration
Swift
public func backward<Group: DynamicGraph.AnyGroup>( to tensor: Group, streamContext: StreamContext? = nil )
Parameters
to
The source tensor to this tensor.
streamContext
The stream context to perform such operation.
-
Transpose from axisA to axisB.
Declaration
Swift
public func transposed(_ axisA: Int, _ axisB: Int, streamContext: StreamContext?) -> DynamicGraph.Group<Element>
-
Fill the given tensor with uniform random values.
Declaration
Swift
public func rand( _ range: ClosedRange<Float>, streamContext: StreamContext? )
-
Fill the given tensor with normal-distributed random values.
Declaration
Swift
public func randn( std: Float, mean: Float, streamContext: StreamContext? )
-
Fill the given tensor with a value.
Declaration
Swift
public func full(_ value: Float, streamContext: StreamContext?)
-
Interpolate from this tensor to the other tensor.
Declaration
Swift
public func lerp( _ weight: Float, to: DynamicGraph.Group<Element>, streamContext: StreamContext? )
-
Clamp the given tensor between two values.
Declaration
Swift
public func clamp(_ range: ClosedRange<Float>, streamContext: StreamContext?)
-
Clamp the given tensor with a lower bound.
Declaration
Swift
public func clamp(_ range: PartialRangeFrom<Float>, streamContext: StreamContext?)
-
Clamp the given tensor with an upper bound.
Declaration
Swift
public func clamp(_ range: PartialRangeThrough<Float>, streamContext: StreamContext?)
-
Detach tensors in this group from the graph. Afterwards, it is always “isConstant” and cannot requiresGrad.
Declaration
Swift
public mutating func detach()
-
Clamp the given tensor between two values.
Declaration
Swift
public func clamped(_ range: ClosedRange<Float>, streamContext: StreamContext?) -> DynamicGraph.Group<Element>
-
Clamp the given tensor with a lower bound.
Declaration
Swift
public func clamped(_ range: PartialRangeFrom<Float>, streamContext: StreamContext?) -> DynamicGraph.Group<Element>
-
Clamp the given tensor with an upper bound.
Declaration
Swift
public func clamped(_ range: PartialRangeThrough<Float>, streamContext: StreamContext?) -> DynamicGraph.Group<Element>
-
Make a copy of the existing tensor group.
Declaration
Swift
public func copied(streamContext: StreamContext?) -> DynamicGraph.Group<Element>
-
Only make a copy of the existing tensor group if it is not contiguous in memory.
Declaration
Swift
public func contiguous(streamContext: StreamContext?) -> DynamicGraph.Group<Element>
-
Reduce along a given dimension.
Declaration
Swift
public func reduced(_ op: ReduceOp, axis: [Int], streamContext: StreamContext?) -> DynamicGraph.Group<Element>
-
Scale the given tensor with a constant inplace.
Declaration
Swift
public func scale(by a: Float, streamContext: StreamContext?)
-
Apply softmax activation to the given tensor inplace.
Declaration
Swift
public func softmax(streamContext: StreamContext?)
-
Apply ReLU activation to the given tensor inplace.
Declaration
Swift
public func ReLU(streamContext: StreamContext?)
-
Apply sigmoid activation to the given tensor inplace.
Declaration
Swift
public func sigmoid(streamContext: StreamContext?)
-
Apply tanh activation to the given tensor inplace.
Declaration
Swift
public func tanh(streamContext: StreamContext?)
-
Apply swish activation to the given tensor inplace.
Declaration
Swift
public func swish(streamContext: StreamContext?)
-
Declaration
Swift
public var untyped: [DynamicGraph.AnyTensor] { get }
-
Declaration
Swift
public var graph: DynamicGraph { get }
-
Declaration
Swift
public var kind: DeviceKind { get }
-
Declaration
Swift
public var shape: TensorShape { get }
-
Declaration
Swift
public var format: TensorFormat { get }
-
Declaration
Swift
public var strides: TensorShape { get }
-
Declaration
Swift
public var isConstant: Bool { get }
-
Declaration
Swift
public var isContiguous: Bool { get }
-
Declaration
Swift
public var requiresGrad: Bool { get set }
-
Declaration
Swift
public var grad: DynamicGraph.Group<DynamicGraph.AnyTensor>? { get set }
-
Declaration
Swift
public var typeErased: DynamicGraph.Group<DynamicGraph.AnyTensor> { get }
-
Declaration
Swift
public var isNaN: Bool { get }
-
Declaration
Swift
public subscript(ranges: [Range<Int>], streamContext streamContext: StreamContext?) -> DynamicGraph.Group<Element>
-
Declaration
Swift
@inlinable public subscript(ranges: Range<Int>..., streamContext streamContext: StreamContext?) -> DynamicGraph.Group<Element>
-
Declaration
Swift
@inlinable public subscript(range: Range<Int>, streamContext streamContext: StreamContext?) -> DynamicGraph.Group<Element>
-
Declaration
Swift
@inlinable public subscript(i0: Int, range: Range<Int>, streamContext streamContext: StreamContext?) -> DynamicGraph.Group<Element>
-
Declaration
Swift
@inlinable public subscript(i0: Int, i1: Int, range: Range<Int>, streamContext streamContext: StreamContext?) -> DynamicGraph.Group<Element>
-
Declaration
Swift
@inlinable public subscript(i0: Int, i1: Int, i2: Int, range: Range<Int>, streamContext streamContext: StreamContext? ) -> DynamicGraph.Group<Element>
-
Declaration
Swift
@inlinable public subscript(i0: Int, i1: Int, i2: Int, i3: Int, range: Range<Int>, streamContext streamContext: StreamContext? ) -> DynamicGraph.Group<Element>
-
Declaration
Swift
@inlinable public subscript(i0: Int, i1: Int, i2: Int, i3: Int, i4: Int, range: Range<Int>, streamContext streamContext: StreamContext? ) -> DynamicGraph.Group< Element >
-
Declaration
Swift
@inlinable public subscript(i0: Int, i1: Int, i2: Int, i3: Int, i4: Int, i5: Int, range: Range<Int>, streamContext streamContext: StreamContext? ) -> DynamicGraph.Group<Element>
-
Declaration
Swift
@inlinable public subscript(i0: Int, i1: Int, i2: Int, i3: Int, i4: Int, i5: Int, i6: Int, range: Range<Int>, streamContext streamContext: StreamContext? ) -> DynamicGraph.Group<Element>
-
Declaration
Swift
@inlinable public subscript(range: UnboundedRange, streamContext streamContext: StreamContext?) -> DynamicGraph.Group<Element>
-
Declaration
Swift
@inlinable public subscript(i0: Int, range: UnboundedRange, streamContext streamContext: StreamContext?) -> DynamicGraph.Group<Element>
-
Declaration
Swift
@inlinable public subscript(i0: Int, i1: Int, range: UnboundedRange, streamContext streamContext: StreamContext? ) -> DynamicGraph.Group<Element>
-
Declaration
Swift
@inlinable public subscript(i0: Int, i1: Int, i2: Int, range: UnboundedRange, streamContext streamContext: StreamContext? ) -> DynamicGraph.Group<Element>
-
Declaration
Swift
@inlinable public subscript(i0: Int, i1: Int, i2: Int, i3: Int, range: UnboundedRange, streamContext streamContext: StreamContext? ) -> DynamicGraph.Group<Element>
-
Declaration
Swift
@inlinable public subscript(i0: Int, i1: Int, i2: Int, i3: Int, i4: Int, range: UnboundedRange, streamContext streamContext: StreamContext? ) -> DynamicGraph.Group< Element >
-
Declaration
Swift
@inlinable public subscript(i0: Int, i1: Int, i2: Int, i3: Int, i4: Int, i5: Int, range: UnboundedRange, streamContext streamContext: StreamContext? ) -> DynamicGraph.Group<Element>
-
Declaration
Swift
@inlinable public subscript(i0: Int, i1: Int, i2: Int, i3: Int, i4: Int, i5: Int, i6: Int, range: UnboundedRange, streamContext streamContext: StreamContext? ) -> DynamicGraph.Group<Element>
-
Scale the given tensor with a constant.
Declaration
Swift
public func scaled(by a: Float, streamContext: StreamContext?) -> DynamicGraph.Group<Element>
-
Explicitly cast the underlying storage to a specific type. It is a helper function than doing DynamicGraph.Group
>(something). Less code change required if we change this from group to tensor. Declaration
Swift
public func `as`<T>(of: T.Type) -> DynamicGraph.Group<DynamicGraph.Tensor<T>> where T : TensorNumeric
-
Declaration
Swift
public func chunked(_ numberOfChunks: Int, axis: Int, streamContext: StreamContext?) -> [`Self`]
-
Declaration
Swift
public typealias AnyTensor = DynamicGraph.Group<DynamicGraph.AnyTensor>
-
Declaration
Swift
public static func exec( cmd: ccv_nnc_cmd_t, hint: ccv_nnc_hint_t, inputs: [DynamicGraph_Any?], outputSize: Int32, streamContext: StreamContext? ) -> [AnyTensor]
-
Declaration
Swift
public static func exec( cmd: ccv_nnc_cmd_t, hint: ccv_nnc_hint_t, inputs: [DynamicGraph_Any?], outputs: [DynamicGraph_Any], streamContext: StreamContext? )
-
Declaration
Swift
public static func evaluate( model: OpaquePointer, testing: Bool, dataParallel: inout Int?, inputs: [DynamicGraph_Any?], outputSize: Int32, streamContext: StreamContext? ) -> [AnyTensor]
-
Declaration
Swift
public func reshaped( format: TensorFormat, shape: TensorShape, offset: TensorShape? = nil, strides: TensorShape? = nil ) -> Self
-
Declaration
Swift
public func reshaped( _ shapeFormat: TensorShapeFormat, offset: TensorShape? = nil, strides: TensorShape? = nil ) -> Self
-
Declaration
Swift
public typealias ElementNumeric = Element.ElementNumeric