RelaxedRankOne is a CT variable exposed to the user to recover the old behavior of how rank 1 tensors are treated in mutating slices. If set to false using -d:RelaxedRankOne=false, slice assignments using rank 1 arrays / seqs / tensors have to match exactly. If it is true, only the number of input elements have to match for a more convenient interface.
Consts
RelaxedRankOne {.booldefine.} = true
- Source Edit
Procs
proc slicerMut[T](t: var Tensor[T]; ellipsis: Ellipsis; slices: openArray[SteppedSlice]; oa: openArray) {.noSideEffect.}
- Assign value from openArrays The openArray must have the same shape as the slice Source Edit
proc slicerMut[T](t: var Tensor[T]; ellipsis: Ellipsis; slices: openArray[SteppedSlice]; t2: Tensor[T])
- Assign the value to the whole slice Source Edit
proc slicerMut[T](t: var Tensor[T]; ellipsis: Ellipsis; slices: openArray[SteppedSlice]; val: T) {.noSideEffect.}
- Take a var Tensor, SteppedSlices, Ellipsis and a value Assign the value to the whole slice Source Edit
proc slicerMut[T](t: var Tensor[T]; slices1: openArray[SteppedSlice]; ellipsis: Ellipsis; slices2: openArray[SteppedSlice]; oa: openArray) {.noSideEffect.}
- Assign value from openArrays The openArray must have the same shape as the slice Source Edit
proc slicerMut[T](t: var Tensor[T]; slices1: openArray[SteppedSlice]; ellipsis: Ellipsis; slices2: openArray[SteppedSlice]; t2: Tensor[T])
- Assign the value to the whole slice Source Edit
proc slicerMut[T](t: var Tensor[T]; slices1: openArray[SteppedSlice]; ellipsis: Ellipsis; slices2: openArray[SteppedSlice]; val: T) {. noSideEffect.}
- Take a var Tensor, Ellipsis, SteppedSlices, Ellipsis and a value Assign the value to the whole slice Source Edit
proc slicerMut[T](t: var Tensor[T]; slices: openArray[SteppedSlice]; ellipsis: Ellipsis; oa: openArray) {.noSideEffect.}
- Assign value from openArrays The openArray must have the same shape as the slice Source Edit
proc slicerMut[T](t: var Tensor[T]; slices: openArray[SteppedSlice]; ellipsis: Ellipsis; t2: Tensor[T])
- Assign the value to the whole slice Source Edit
proc slicerMut[T](t: var Tensor[T]; slices: openArray[SteppedSlice]; ellipsis: Ellipsis; val: T) {.noSideEffect.}
- Take a var Tensor, SteppedSlices, Ellipsis and a value Assign the value to the whole slice Source Edit
proc slicerMut[T](t: var Tensor[T]; slices: openArray[SteppedSlice]; oa: openArray) {.noSideEffect.}
- Assign value from openArrays The openArray must have the same shape as the slice Source Edit
proc slicerMut[T](t: var Tensor[T]; slices: openArray[SteppedSlice]; t2: Tensor[T])
- Assign the value to the whole slice Source Edit
proc slicerMut[T](t: var Tensor[T]; slices: openArray[SteppedSlice]; val: T) {. noSideEffect.}
- Assign the value to the whole slice Source Edit
Macros
macro slice_typed_dispatch_mut(t: typed; args: varargs[typed]; val: typed): untyped
- Assign val to Tensor T at slice/position args Source Edit
macro slice_typed_dispatch_var(t: typed; args: varargs[typed]): untyped
- Typed macro so that isAllInt has typed context and we can dispatch. If args are all int, we dispatch to atIndex and return T Else, all ints are converted to SteppedSlices and we return a Tensor. Note, normal slices and _ were already converted in the [] macro TODO in total we do 3 passes over the list of arguments :/. It is done only at compile time though Source Edit