Skip to content

Commit

Permalink
First draft for saved model export API
Browse files Browse the repository at this point in the history
  • Loading branch information
karllessard committed Jun 29, 2020
1 parent 58b28ea commit bdb0420
Show file tree
Hide file tree
Showing 6 changed files with 293 additions and 242 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@
import org.tensorflow.op.core.SetDiff1d;
import org.tensorflow.op.core.SetSize;
import org.tensorflow.op.core.ShapeN;
import org.tensorflow.op.core.ShapeOps;
import org.tensorflow.op.core.Size;
import org.tensorflow.op.core.Skipgram;
import org.tensorflow.op.core.Slice;
Expand Down Expand Up @@ -337,10 +336,10 @@ public final class Ops {

public final SignalOps signal;

public final QuantizationOps quantization;

public final TrainOps train;

public final QuantizationOps quantization;

private final Scope scope;

private Ops(Scope scope) {
Expand All @@ -360,8 +359,8 @@ private Ops(Scope scope) {
math = new MathOps(scope);
audio = new AudioOps(scope);
signal = new SignalOps(scope);
quantization = new QuantizationOps(scope);
train = new TrainOps(scope);
quantization = new QuantizationOps(scope);
}

/**
Expand Down Expand Up @@ -2298,58 +2297,6 @@ public <T extends TType> Fingerprint fingerprint(Operand<T> data, Operand<TStrin
return Fingerprint.create(scope, data, method);
}

/**
* Flatten the operand to 1 dimension
*
* @param <T> the type of operand
* @param scope current scope
* @param operand the operand to flatten
* @return the reshaped operand
*/
public <T extends TType> Operand<T> flatten(Operand<T> operand) {
return ShapeOps.flatten(scope, operand);
}

/**
* Flatten the shape to 1 dimension
*
* @param scope current scope
* @param shape the TensorFlow shape
* @return the flattened shape
*/
public Operand<TInt32> flatten(org.tensorflow.op.core.Shape<TInt32> shape) {
return ShapeOps.flatten(scope, shape);
}

/**
* Flatten the operand to 1 dimension
*
* @param <T> the type of operand
* @param <U> the shape datatype.
* @param scope current scope
* @param operand the operand to flatten
* @param dType the shape datatype.
* @return the reshaped operand
*/
public <T extends TType, U extends TNumber> Operand<T> flatten(Operand<T> operand,
DataType<U> dType) {
return ShapeOps.flatten(scope, operand, dType);
}

/**
* Flatten the shape to 1 dimension
*
* @param <U> the shape datatype.
* @param scope current scope
* @param shape the TensorFlow shape
* @param dType the shape datatype.
* @return the flattened shape
*/
public <U extends TNumber> Operand<U> flatten(org.tensorflow.op.core.Shape<U> shape,
DataType<U> dType) {
return ShapeOps.flatten(scope, shape, dType);
}

/**
* Gather slices from `params` axis `axis` according to `indices`.
* <p>
Expand Down Expand Up @@ -3380,31 +3327,6 @@ public NoOp noOp() {
return NoOp.create(scope);
}

/**
* Get the number of dimensions of the shape object
*
* @param scope current scope
* @param shape the shape
* @return the number of dimensions
*/
public Operand<TInt32> numDimensions(org.tensorflow.op.core.Shape<TInt32> shape) {
return ShapeOps.numDimensions(scope, shape);
}

/**
* Get the number of dimensions of the shape object
*
* @param <U> the shape datatype.
* @param scope the curren scope
* @param shape the shape
* @param dType the shape datatype.
* @return the number of dimensions
*/
public <U extends TNumber> Operand<U> numDimensions(org.tensorflow.op.core.Shape<U> shape,
DataType<U> dType) {
return ShapeOps.numDimensions(scope, shape, dType);
}

/**
* Returns a one-hot tensor.
* <p>
Expand Down Expand Up @@ -3936,63 +3858,6 @@ public <T extends TNumber> ReduceAny reduceAny(Operand<TBool> input, Operand<T>
return ReduceAny.create(scope, input, axis, options);
}

/**
* Reshapes the operand to the specified axis,
*
* @param <T> the type of Operand
* @param scope current scope
* @param operand the operand
* @param axis the axis
* @return the reshaped operand
*/
public <T extends TType> Operand<T> reduceDims(Operand<T> operand, Operand<TInt32> axis) {
return ShapeOps.reduceDims(scope, operand, axis);
}

/**
* Reduces the shape to the specified axis,
*
* @param scope current scope
* @param shape the TensorFlow shape
* @param axis the axis
* @return the reduced shape
*/
public Operand<TInt32> reduceDims(org.tensorflow.op.core.Shape<TInt32> shape,
Operand<TInt32> axis) {
return ShapeOps.reduceDims(scope, shape, axis);
}

/**
* Reshapes the operand to the specified axis,
*
* @param <T> the type of Operand
* @param <U> the shape datatype.
* @param scope current scope
* @param operand the operand
* @param axis the axis
* @param dType the shape datatype.
* @return the reshaped operand
*/
public <T extends TType, U extends TNumber> Operand<T> reduceDims(Operand<T> operand,
Operand<U> axis, DataType<U> dType) {
return ShapeOps.reduceDims(scope, operand, axis, dType);
}

/**
* Reduces the shape to the specified axis,
*
* @param <U> the shape datatype.
* @param scope current scope
* @param shape the TensorFlow shape
* @param axis the axis
* @param dType the shape datatype.
* @return the reduced shape
*/
public <U extends TNumber> Operand<U> reduceDims(org.tensorflow.op.core.Shape<U> shape,
Operand<U> axis, DataType<U> dType) {
return ShapeOps.reduceDims(scope, shape, axis, dType);
}

/**
* Computes the maximum of elements across dimensions of a tensor.
* <p>
Expand Down Expand Up @@ -5620,29 +5485,6 @@ public <T extends TType> Size<TInt32> size(Operand<T> input) {
return Size.create(scope, input);
}

/**
* Get the size represented by the TensorFlow shape
*
* @param scope current scope
* @param shape the TensorFlow shape
* @return the size
*/
public Operand<TInt32> size(org.tensorflow.op.core.Shape<TInt32> shape) {
return ShapeOps.size(scope, shape);
}

/**
* Get the size of the specified dimension for the shape of the tensor
*
* @param scope current scope
* @param input the operand
* @param dim the dimension
* @return the size of the specified dimension
*/
public Operand<TInt32> size(Operand input, Operand<TInt32> dim) {
return ShapeOps.size(scope, input, dim);
}

/**
* Returns the size of a tensor.
* <p>
Expand All @@ -5664,61 +5506,6 @@ public <U extends TNumber, T extends TType> Size<U> size(Operand<T> input, DataT
return Size.create(scope, input, outType);
}

/**
* Get the size represented by the TensorFlow shape
*
* @param <U> the shape datatype. the type of the shape
* @param scope current scope
* @param shape the TensorFlow shape
* @param dType the shape datatype.
* @return the size
*/
public <U extends TNumber> Operand<U> size(org.tensorflow.op.core.Shape<U> shape,
DataType<U> dType) {
return ShapeOps.size(scope, shape, dType);
}

/**
* Get the size of the specified dimension in the shape
*
* @param scope current scope
* @param shape the TensorFlow shape
* @param dim the dimension
* @return the size of the specified dimension
*/
public Operand<TInt32> size(org.tensorflow.op.core.Shape<TInt32> shape, Operand<TInt32> dim) {
return ShapeOps.size(scope, shape, dim);
}

/**
* Get the size of the specified dimension for the shape of the tensor
*
* @param <U> the shape datatype.
* @param scope current scope
* @param input the operand
* @param dim the dimension
* @param dType the shape datatype.
* @return the size of the specified dimension
*/
public <U extends TNumber> Operand<U> size(Operand input, Operand<U> dim, DataType<U> dType) {
return ShapeOps.size(scope, input, dim, dType);
}

/**
* Get the size of the specified dimension in the shape
*
* @param <U> the shape datatype.
* @param scope current scope
* @param shape the TensorFlow shape
* @param dim the dimension
* @param dType the shape datatype.
* @return the size of the specified dimension
*/
public <U extends TNumber> Operand<U> size(org.tensorflow.op.core.Shape<U> shape, Operand<U> dim,
DataType<U> dType) {
return ShapeOps.size(scope, shape, dim, dType);
}

/**
* Parses a text file and creates a batch of examples.
*
Expand Down Expand Up @@ -5915,17 +5702,6 @@ public <T extends TType, U extends TNumber> SplitV<T> splitV(Operand<T> value,
return SplitV.create(scope, value, sizeSplits, axis, numSplit);
}

/**
* Removes dimensions of size 1 from the shape
*
* @param scope current scope
* @param shape the TensorFlow shape
* @return the squeezed shape
*/
public Operand<TInt32> squeeze(org.tensorflow.op.core.Shape<TInt32> shape) {
return ShapeOps.squeeze(scope, shape);
}

/**
* Removes dimensions of size 1 from the shape of a tensor.
* <p>
Expand Down Expand Up @@ -5954,20 +5730,6 @@ public <T extends TType> Squeeze<T> squeeze(Operand<T> input, Squeeze.Options...
return Squeeze.create(scope, input, options);
}

/**
* Removes dimensions of size 1 from the shape
*
* @param <U> the shape datatype.
* @param scope current scope
* @param shape the TensorFlow shape
* @param dType the shape datatype.
* @return the squeezed shape
*/
public <U extends TNumber> Operand<U> squeeze(org.tensorflow.op.core.Shape<U> shape,
DataType<U> dType) {
return ShapeOps.squeeze(scope, shape, dType);
}

/**
* Packs a list of `N` rank-`R` tensors into one rank-`(R+1)` tensor.
* <p>
Expand Down

0 comments on commit bdb0420

Please sign in to comment.