public final class BroadcastUtils extends Object
| Constructor and Description |
|---|
BroadcastUtils() |
| Modifier and Type | Method and Description |
|---|---|
static List<int[]> |
broadcastShapes(int[]... shapes)
Take in shapes and broadcast them to same rank
|
static List<int[]> |
broadcastShapesToMax(int[] maxShape,
int[]... shapes)
Take in shapes and broadcast them to maximum shape
|
static int[][] |
calculateBroadcastShapes(int[] oldShape,
int size,
int... newShape)
Calculate shapes for broadcasting
|
static Dataset[] |
convertAndBroadcast(Object... objects)
Converts and broadcast all objects as datasets of same shape
|
static int[] |
createBroadcastStrides(Dataset a,
int[] broadcastShape)
Create a stride array from a dataset to a broadcast shape
|
static int[] |
createBroadcastStrides(int isize,
int[] oShape,
int[] oStride,
int[] broadcastShape)
Create a stride array from a dataset to a broadcast shape
|
static int[] |
padShape(int[] shape,
int padding)
Pad shape by prefixing with ones
|
public BroadcastUtils()
public static int[][] calculateBroadcastShapes(int[] oldShape, int size, int... newShape)
oldShape - old shapesize - dataset sizenewShape - new shapepublic static int[] padShape(int[] shape, int padding)
shape - to padpadding - number of dimensions to addpublic static List<int[]> broadcastShapes(int[]... shapes)
shapes - null shapes are ignored and passed throughpublic static List<int[]> broadcastShapesToMax(int[] maxShape, int[]... shapes)
maxShape - maximum shapeshapes - inputspublic static int[] createBroadcastStrides(Dataset a, int[] broadcastShape)
a - datasetbroadcastShape - shape to broadcastpublic static int[] createBroadcastStrides(int isize, int[] oShape, int[] oStride, int[] broadcastShape)
isize - item sizeoShape - original shapeoStride - original stridebroadcastShape - shape to broadcastpublic static Dataset[] convertAndBroadcast(Object... objects)
objects - to convert and broadcastCopyright © 2014–2022 Eclipse Foundation. All rights reserved.