MCPcopy Create free account
hub / github.com/pytorch/pytorch / testPropagateRequestOnly

Method testPropagateRequestOnly

caffe2/python/layers_test.py:1536–1554  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1534 self.assertEqual((1,), loss.field_types()[0].shape)
1535
1536 def testPropagateRequestOnly(self):
1537 # test case when output is request only
1538 input_record = self.new_record(schema.Struct(
1539 ('input1', schema.Scalar((np.float32, (32, )))),
1540 ('input2', schema.Scalar((np.float32, (64, )))),
1541 ('input3', schema.Scalar((np.float32, (16, )))),
1542 ))
1543
1544 set_request_only(input_record)
1545 concat_output = self.model.Concat(input_record)
1546 self.assertEqual(is_request_only_scalar(concat_output), True)
1547
1548 # test case when output is not request only
1549 input_record2 = self.new_record(schema.Struct(
1550 ('input4', schema.Scalar((np.float32, (100, ))))
1551 )) + input_record
1552
1553 concat_output2 = self.model.Concat(input_record2)
1554 self.assertEqual(is_request_only_scalar(concat_output2), False)
1555
1556 def testSetRequestOnly(self):
1557 input_record = schema.Scalar(np.int64)

Callers

nothing calls this directly

Calls 5

set_request_onlyFunction · 0.90
is_request_only_scalarFunction · 0.90
new_recordMethod · 0.80
ConcatMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected