Пример #1
0
 /// <summary>
 /// Computes a new repeated sequence (of length sequenceLength) of batched values
 /// (of length sequenceBatchLength), and writes the computed values to the given
 /// view. Afterwards, the target view will contain the following values:
 /// - [0, sequenceLength - 1] =
 ///       - [0, sequenceBatchLength - 1] = sequencer(0),
 ///       - [sequenceBatchLength, sequenceBatchLength * 2 - 1] = sequencer(1),
 ///       - ...
 /// - [sequenceLength, sequenceLength * 2 - 1]
 ///       - [sequenceLength,
 ///          sequenceLength + sequenceBatchLength - 1] = sequencer(0),
 ///       - [sequenceLength + sequenceBatchLength,
 ///          sequenceLength + sequenceBatchLength * 2 - 1] = sequencer(1),
 ///       - ...
 /// - ...
 /// </summary>
 /// <typeparam name="T">The element type.</typeparam>
 /// <typeparam name="TSequencer">The type of the sequencer to use.</typeparam>
 /// <param name="accelerator">The accelerator.</param>
 /// <param name="stream">The accelerator stream.</param>
 /// <param name="view">The target view.</param>
 /// <param name="sequenceLength">The length of a single sequence.</param>
 /// <param name="sequenceBatchLength">The length of a single batch.</param>
 /// <param name="sequencer">The used sequencer.</param>
 public static void RepeatedBatchedSequence <T, TSequencer>(
     this Accelerator accelerator,
     AcceleratorStream stream,
     ArrayView <T> view,
     LongIndex1D sequenceLength,
     LongIndex1D sequenceBatchLength,
     TSequencer sequencer)
     where T : unmanaged
     where TSequencer : struct, ISequencer <T> =>
 accelerator.CreateRepeatedBatchedSequencer <T, Stride1D.Dense, TSequencer>()(
     stream,
     view,
     sequenceLength,
     sequenceBatchLength,
     sequencer);
Пример #2
0
 /// <summary>
 /// Computes a new repeated sequence (of length sequenceLength) of batched values (of length sequenceBatchLength),
 /// and writes the computed values to the given view. Afterwards, the target view will contain the following values:
 /// - [0, sequenceLength - 1] =
 ///       - [0, sequenceBatchLength - 1] = sequencer(0),
 ///       - [sequenceBatchLength, sequenceBatchLength * 2 - 1] = sequencer(1),
 ///       - ...
 /// - [sequenceLength, sequenceLength * 2 - 1]
 ///       - [sequenceLength, sequenceLength + sequenceBatchLength - 1] = sequencer(0),
 ///       - [sequenceLength + sequenceBatchLength, sequenceLength + sequenceBatchLength * 2 - 1] = sequencer(1),
 ///       - ...
 /// - ...
 /// </summary>
 /// <typeparam name="T">The element type.</typeparam>
 /// <typeparam name="TSequencer">The type of the sequencer to use.</typeparam>
 /// <param name="accelerator">The accelerator.</param>
 /// <param name="stream">The accelerator stream.</param>
 /// <param name="view">The target view.</param>
 /// <param name="sequenceLength">The length of a single sequence.</param>
 /// <param name="sequenceBatchLength">The length of a single batch.</param>
 /// <param name="sequencer">The used sequencer.</param>
 public static void RepeatedBatchedSequence <T, TSequencer>(
     this Accelerator accelerator,
     AcceleratorStream stream,
     ArrayView <T> view,
     Index sequenceLength,
     Index sequenceBatchLength,
     TSequencer sequencer)
     where T : struct
     where TSequencer : struct, ISequencer <T>
 {
     accelerator.CreateRepeatedBatchedSequencer <T, TSequencer>()(
         stream,
         view,
         sequenceLength,
         sequenceBatchLength,
         sequencer);
 }