code: def test_get_sequence_lengths_from_binary_mask(self):
      binary_mask = torch.ByteTensor(
          [
              [1, 1, 1, 0, 0, 0],
              [1, 1, 0, 0, 0, 0],
              [1, 1, 1, 1, 1, 1],
              [1, 0, 0, 0, 0, 0],
          ]
      )
      lengths = util.get_lengths_from_binary_sequence_mask(binary_mask)
      numpy.testing.assert_array_equal(
          lengths.numpy(), numpy.array([3, 2, 6, 1])
      )
  
imports: from __future__ import with_statement
  from __future__ import division
  from __future__ import absolute_import
  import numpy
  from numpy.testing import assert_array_almost_equal, assert_almost_equal
  import torch
  import pytest
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.testing import AllenNlpTestCase
  from allennlp.nn import util
label_desc: Use image node_id 1 for calling the TestNnUtil obj's underlying member method code with example usage: obj.test_get_sequence_lengths_from_binary_mask() without return types