### Question:
GraphOperationBuilder implements OperationBuilder { @Override public GraphOperationBuilder setAttr(String name, String value) { setAttr(name, value.getBytes(Charset.forName("UTF-8"))); return this; } GraphOperationBuilder(Graph graph, String type, String name); @Override GraphOperation build(); @Override GraphOperationBuilder addControlInput(Operation control); @Override GraphOperationBuilder addInput(Output<?> input); @Override GraphOperationBuilder addInputList(Output<?>[] inputs); @Override GraphOperationBuilder setDevice(String device); @Override GraphOperationBuilder setAttr(String name, String value); @Override GraphOperationBuilder setAttr(String name, byte[] value); @Override GraphOperationBuilder setAttr(String name, long value); @Override GraphOperationBuilder setAttr(String name, long[] value); @Override GraphOperationBuilder setAttr(String name, float value); @Override GraphOperationBuilder setAttr(String name, float[] value); @Override GraphOperationBuilder setAttr(String name, boolean value); @Override GraphOperationBuilder setAttr(String name, boolean[] value); @Override GraphOperationBuilder setAttr(String name, DataType value); @Override GraphOperationBuilder setAttr(String name, DataType[] value); @Override GraphOperationBuilder setAttr(String name, Tensor<?> value); @Override GraphOperationBuilder setAttr(String name, Tensor<?>[] value); @Override GraphOperationBuilder setAttr(String name, Shape value); @Override GraphOperationBuilder setAttr(String name, Shape[] value); @Override GraphOperationBuilder setAttr(String name, String[] value);  }### Answer:
@Test public void setAttr() { try (Graph g = new Graph()) { Ops tf = Ops.create(g); try (Tensor<TInt32> t = TInt32.scalarOf(1)) { g.opBuilder("Const", "DataTypeAndTensor") .setAttr("dtype", TInt32.DTYPE) .setAttr("value", t) .build() .output(0); assertTrue(hasNode(g, "DataTypeAndTensor")); } g.opBuilder("Abort", "StringAndBool") .setAttr("error_msg", "SomeErrorMessage") .setAttr("exit_without_error", false) .build(); assertTrue(hasNode(g, "StringAndBool")); g.opBuilder("RandomUniform", "Int") .addInput(tf.array(1).asOutput()) .setAttr("seed", 10) .setAttr("dtype", TFloat32.DTYPE) .build(); assertTrue(hasNode(g, "Int")); g.opBuilder("MaxPool", "IntList") .addInput(tf.constant(new float[2][2][2][2]).asOutput()) .setAttr("ksize", new long[] {1, 1, 1, 1}) .setAttr("strides", new long[] {1, 1, 1, 1}) .setAttr("padding", "SAME") .build(); assertTrue(hasNode(g, "IntList")); g.opBuilder("FractionalMaxPool", "FloatList") .addInput(tf.constant(new float[2][2][2][2]).asOutput()) .setAttr("pooling_ratio", new float[] {1.0f, 1.44f, 1.73f, 1.0f}) .build(); assertTrue(hasNode(g, "FloatList")); } }