b2756dda944a6a65e98bedc51cbe42238222ccf0,examples/toy_model_tpu.py,,toy_model,#Any#Any#,97
Before Change
io_dim = mtf.Dimension("io", FLAGS.io_size)
x = mtf.import_tf_tensor(mesh, features, mtf.Shape([batch_dim, io_dim]))
h = mtf.layers.dense(x, hidden_dim, name="layer1", use_bias=False)
y = mtf.layers.dense(h, io_dim, name="layer2", use_bias=False)
loss = mtf.reduce_sum(mtf.square(y - x))
return y, loss
After Change
x = mtf.import_tf_tensor(mesh, features, mtf.Shape([batch_dim, io_dim]))
x = mtf.cast(x, activation_dtype)
h = x
for lnum in xrange(FLAGS.num_hidden_layers + 1):
if lnum + 1 == FLAGS.num_hidden_layers + 1:
dim = io_dim
elif lnum % 2 == 0:
dim = mtf.Dimension("hidden_even", FLAGS.hidden_size)
else:
dim = mtf.Dimension("hidden_odd", FLAGS.hidden_size)
h = mtf.layers.dense(
h, dim,
use_bias=False,
master_dtype=master_dtype,
slice_dtype=slice_dtype,
name="layer_%d" % lnum)
y = h
loss = mtf.reduce_mean(mtf.square(y - x))
return y, loss
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances Project Name: tensorflow/mesh
Commit Name: b2756dda944a6a65e98bedc51cbe42238222ccf0
Time: 2018-10-31
Author: noam@google.com
File Name: examples/toy_model_tpu.py
Class Name:
Method Name: toy_model
Project Name: OpenNMT/OpenNMT-tf
Commit Name: 3c40fb8c1476e9f3e2acfbf9d6bbe56d3c1b0618
Time: 2019-07-04
Author: guillaume.klein@systrangroup.com
File Name: opennmt/tests/checkpoint_test.py
Class Name: _DummyModel
Method Name: call
Project Name: tensorflow/tpu
Commit Name: 4955b57810297f6a615273e8d8f46f5eb3f55197
Time: 2019-12-20
Author: pengchong@google.com
File Name: models/official/detection/modeling/architecture/heads.py
Class Name: FastrcnnHead
Method Name: __call__